We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Combobox questions

Thread ID:





16062 Jul 5,2004 03:49 PM Jul 5,2004 05:37 PM Windows Forms 1
Tags: GridControl
Corinne Muir
Asked On July 5, 2004 03:49 PM

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

Administrator [Syncfusion]
Replied On July 5, 2004 05:37 PM

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"; }


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.