Combobox questions

Hi, 1) is there a way to use the actual object in a combobox in a grid cell other than setting a text choice list? The .net combobox lets you assign objects to the .items 2) is there a way to sort the combobox choice list? thanks, Corinne

1 Reply

AD Administrator Syncfusion Team July 5, 2004 09:37 PM UTC

You can set the style.DataSource, style.DisplayMember and style.ValueMember to use an ADO.NET datasource to provide values for a combobox list. private void Form1_Load(object sender, System.EventArgs e) { DataTable dt = new DataTable("MyTable"); dt.Columns.Add(new DataColumn("value")); dt.Columns.Add(new DataColumn("display")); DataRow dr = dt.NewRow(); dr[0] ="1"; dr[1] = "one"; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] ="2"; dr[1] = "two"; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] ="3"; dr[1] = "three"; dt.Rows.Add(dr); GridStyleInfo style = this.gridControl1[2,2]; style.CellType = "ComboBox"; style.DataSource = dt; style.ValueMember = "value"; style.DisplayMember = "display"; }

Loader.
Up arrow icon