// **************************************************// Custom code for UD01Form// Created: 06-12-2023 17:12:37// **************************************************using System;using System.ComponentModel;using System.Data;using System.Diagnostics;using System.Windows.Forms;using Ice.BO;using Erp.BO;using Ice.UI;using Ice.Lib;using Ice.Adapters;using Ice.Lib.Customization;using Ice.Lib.ExtendedProps;using Ice.Lib.Framework;using Ice.Lib.Searches;using Ice.UI.FormFunctions;using Infragistics.Win.UltraWinGrid;
public class Script{ // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! ** // Begin Wizard Added Module Level Variables **// private ComboBox cmbCodeDesc; // private UltraGrid grdDetail;
private UltraDropDown ultraDropDown1; // Add this line at the class level or within the appropriate scope
// Declare cmbCodeDesc at the class level
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode() { // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines ** // Begin Wizard Added Variable Initialization// Inside the form's constructor or load event
// Add additional initialization logic if required
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls this.btnRow.Click += new System.EventHandler(this.btnRow_Click);
// End Wizard Added Custom Method Calls }
public void DestroyCustomCode() { // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines ** // Begin Wizard Added Object Disposal this.btnRow.Click -= new System.EventHandler(this.btnRow_Click); // End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void btnRow_Click(object sender, System.EventArgs args) { // ** Place Event Handling Code Here ** } private void grdValidShipTo_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { // ** Place Event Handling Code Here ** e.Layout.Bands[0].Columns["Int32 1"].ValueList = ultraDropDown1; } private void bindUltraDropDown() { DataTable dt = new DataTable(); dt.Columns.Add("CodeDesc", typeof(string)); dt.Columns.Add("CodeDesc", typeof(string)); dt.Rows.Add(new object[] {1, "A"}); dt.Rows.Add(new object[] {2, "B"}); dt.Rows.Add(new object[] {3, "C"}); dt.AcceptChanges(); UltraDropDown ultraDropDown1 = new UltraDropDown(); ultraDropDown1.SetDataBinding(dt, null); ultraDropDown1.ValueMember = "CodeDesc"; ultraDropDown1.DisplayMember = "CodeDesc";
can you plz tell me how we can attach
Hello and thank you for contacting Infragistics. Do you have an Int32 1 column? It appears this is taken from one of our samples explained here:
https://www.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/86296/ultradropdown-within-ultrawingrid-cell-via-designer
private void Form1_Load(object sender, System.EventArgs e) { this.BindUltraDropDown(); } private void BindUltraDropDown() { DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("DisplayText", typeof(string)); dt.Rows.Add(new object[] {1, "A"}); dt.Rows.Add(new object[] {2, "B"}); dt.Rows.Add(new object[] {3, "C"}); dt.AcceptChanges(); this.ultraDropDown1.SetDataBinding(dt, null); this.ultraDropDown1.ValueMember = "ID"; this.ultraDropDown1.DisplayMember = "DisplayText"; } private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Bands[0].Columns["Int32 1"].ValueList = this.ultraDropDown1; }
using System;using System.ComponentModel;using System.Data;using System.Collections;using System.Diagnostics;using System.Windows.Forms;using Ice.BO;using Erp.BO;using Ice.UI;using Ice.Lib;using Ice.Adapters;using Ice.Lib.Customization;using Ice.Lib.ExtendedProps;using Ice.Lib.Framework;using Ice.Lib.Searches;using Ice.UI.FormFunctions;using Infragistics.Win.UltraWinGrid; public class Script{ // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! ** // Begin Wizard Added Module Level Variables ** private string ComplaintNo; private ArrayList arr; private string complaintnum; private EpiDataView edvUD12; // Add this line at the class level or within the appropriate scope
// Declare cmbCodeDesc at the class level // End Wizard Added Module Level Variables ** // Add Custom Module Level Variables Here ** public void InitializeCustomCode() { // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines ** // Begin Wizard Added Variable Initialization// Inside the form's constructor or load event// Add additional initialization logic if required // End Wizard Added Variable Initialization // Begin Wizard Added Custom Method Calls this.btnComplaintNo.Click += new System.EventHandler(this.btnComplaintNo_Click); this.txtComplaintNo.ValueChanged += new System.EventHandler(this.txtComplaintNo_ValueChanged);// End Wizard Added Custom Method Calls } public void DestroyCustomCode() { // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines ** // Begin Wizard Added Object Disposal this.btnComplaintNo.Click -= new System.EventHandler(this.btnComplaintNo_Click); this.txtComplaintNo.ValueChanged -= new System.EventHandler(this.txtComplaintNo_ValueChanged);// End Wizard Added Object Disposal // Begin Custom Code Disposal // End Custom Code Disposal}
private void btnComplaintNo_Click(object sender, System.EventArgs args) { // ** Place Event Handling Code Here ** SearchOnUD12AdapterShowDialog(); }
private void SearchOnUD12AdapterShowDialog() { try { EpiDataView edvUD12 = ((EpiDataView)(this.oTrans.EpiDataViews["UD12"])); System.Data.DataRow edvUD12Row = edvUD12.CurrentDataRow; QuickSearchAdapter adQuickSearch = new QuickSearchAdapter(oTrans); adQuickSearch.BOConnect(); DataTable dt = null; string sQuicksearchname = "VS_ComplaintSearch"; bool sch = adQuickSearch.GetByID("", sQuicksearchname); if (adQuickSearch != null) { object fm = adQuickSearch.ShowQuickSearch(oTrans, true, dt,adQuickSearch.ToString()); arr = (ArrayList)fm; foreach (string AllKeys in arr) { if(AllKeys != string.Empty) { string[] sKey = AllKeys.Split(';'); string strComplaintNo = sKey[0]; complaintnum = strComplaintNo; edvUD12Row["Key2"]=strComplaintNo; } } //} }} catch (Exception Ex) { //MessageBox.Show("Error"); //MessageBox.Show(Ex.Message, "...", MessageBoxButtons.OK, MessageBoxIcon.Error);}}
private void txtComplaintNo_ValueChanged(object sender, System.EventArgs args) { try { EpiDataView edvUD12 = ((EpiDataView)(this.oTrans.EpiDataViews["UD12"])); System.Data.DataRow edvUD12Row = edvUD12.CurrentDataRow; DynamicQueryAdapter dqa = new DynamicQueryAdapter(this.oTrans); dqa.BOConnect(); Ice.BO.QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("VS_Rectification_BAQ"); qeds.ExecutionParameter.Clear(); qeds.ExecutionParameter.AddExecutionParameterRow("complaintnum",complaintnum, "nvarchar", false, Guid.NewGuid(),"A"); dqa.ExecuteByID("VS_Rectification_BAQ", qeds); if (dqa.QueryResults.Tables["Results"].Rows.Count > 0) { foreach (DataRow item in dqa.QueryResults.Tables["Results"].Rows) { edvUD12Row["Key2"] = Convert.ToString(item["UD01_Key1"]); edvUD12Row["Key3"] = Convert.ToString(item["UD01_Key2"]); edvUD12Row["Key4"] = Convert.ToString(item["UD01_Key3"]); edvUD12Row["Character02"] = Convert.ToString(item["UD01_Key4"]); edvUD12Row["Character04"] = Convert.ToString(item["UD01_Character03"]); edvUD12Row["Character05"] = Convert.ToString(item["UD01_ShortChar01"]); edvUD12Row["Character06"] = Convert.ToString(item["UD01_Character05"]); edvUD12Row["Character07"] = Convert.ToString(item["UD01_Character06"]); } } ;}catch (Exception ex){ // MessageBox.Show("Exception: " + ex.Message);}}} i am writing this code but in this code i am using baq to add the data through complaint number but how we can attached/ retrieve All grid data to this grid can you plz help me
Hello Shubhangi,
I am rather unsure of what you are looking to achieve with your most recent update and how it differs from your original one? Can you please elaborate on this?
If this is still difficulty in binding data to an UltraDropDown in the UltraGrid, I would recommend utilizing Michael’s update above, in which you can utilize the ValueList property on the UltraGridColumn element.
Please let me know if you have any other questions or concerns on this matter.