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.

Binding values to Combo Box cell type during runtime.

Thread ID:

Created:

Updated:

Platform:

Replies:

43197 Apr 18,2006 08:30 AM Apr 25,2006 12:54 AM Windows Forms 3
loading
Tags: GridControl
Ravichandran
Asked On April 18, 2006 08:30 AM

Hi I am using Gridcontrol and while initializing the column I am setting a particular column''s celltype as "ComboBox". I want to bind some data to that coulumn during runtime.(to display all countrycodes), How to set the datasource? Thanks Ravi

Administrator [Syncfusion]
Replied On April 19, 2006 03:00 AM

Hi Ravi, Please try this code to assign the datsource of the combobox cell in a grid during runtime. //For comboboxcell type column 2 this.gridControl1[1,2].DataSource = GetTable(cc.Renderer.ControlText); this.gridControl1[1,2].DisplayMember = "Name"; this.gridControl1[1,2].ValueMember = "Value"; Here is a sample for implementing it. http://www.syncfusion.com/Support/user/uploads/ComboSample_1178bc36.zip Please let me know if you need any further assistance. Regards, Haneef

Ravichandran
Replied On April 24, 2006 09:57 AM

Hi We are having our own datasoruce ( its an array of objects). In QueryCellInfo event we are setting the values for each cell during runtime by assigning the values from our datasoruce.. if (e.RowIndex > 0) { e.Style.CellValue = m_document[e.RowIndex - 1, e.ColIndex]; e.Handled = true; } where m_document is collection of objects. Now here in one of the col I want to have combobox. I dont knwo how to bind the combo with another datasource ( array of country objects) .. Pls reply me AEAP. Thaks Ravi >Hi Ravi, > >Please try this code to assign the datsource of the combobox cell in a grid during runtime. > >//For comboboxcell type column 2 >this.gridControl1[1,2].DataSource = GetTable(cc.Renderer.ControlText); >this.gridControl1[1,2].DisplayMember = "Name"; >this.gridControl1[1,2].ValueMember = "Value"; > >Here is a sample for implementing it. >http://www.syncfusion.com/Support/user/uploads/ComboSample_1178bc36.zip > >Please let me know if you need any further assistance. >Regards, >Haneef

Administrator [Syncfusion]
Replied On April 25, 2006 12:54 AM

Hi Ravi, Could you try this code to configure the combobox celltype.Here is a sample. if(e.ColIndex == 2 && e.RowIndex > 0) { // For more than on element in a arraylist e.Style.DisplayMember/ValueMember is necessary for showing the element. e.Style.DataSource = GetList(m_document[e.RowIndex - 1, e.ColIndex].ToString()); e.Style.CellType = "ComboBox"; } Here is a sample. http://www.syncfusion.com/Support/user/uploads/ComboSample_1b508fa6.zip Please let me know if this helps. Regards, Haneef

CONFIRMATION

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.

;