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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding values to Combo Box cell type during runtime.

Thread ID:





43197 Apr 18,2006 12:30 PM UTC Apr 25,2006 04:54 AM UTC WinForms 3
Tags: GridControl
Asked On April 18, 2006 12:30 PM UTC

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 07:00 AM UTC

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

Replied On April 24, 2006 01:57 PM UTC

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 04:54 AM UTC

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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon