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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridDataBoundGrid comboBox

Thread ID:





20738 Oct 25,2004 12:50 AM UTC Oct 27,2004 07:48 AM UTC WinForms 7
Tags: GridControl
Maqsood Ahmed
Asked On October 25, 2004 12:50 AM UTC

Hello! Scenario: I have a GDBG with datasource set to dataTable1. One of the Grid''s columns is of ComboBox type and its DataSource is Set to dataTable2 and it displays Display/Values pairs from dataTable2. I have 2 questions now: 1. I want to display selected option from the combobox to the Grid... but it disappears when the combobox cell loses focus. How can I set it? one possible solution is to bind Combobox column with a DataTable column and link that column to dataTable2''s column that is to be displayed. but How?? 2. Do we have any event that indicates that ComboBox has been Dropped?? Such as Windows.Forms.ComboBox.DropDown event? Thanx in Advance Maqsood Ahmed Kolachi Advanced Technologies http://www.kolachi.net

Maqsood Ahmed
Replied On October 25, 2004 01:37 AM UTC

One more question related to the same is: I want to disable Grid Combos when a checkbox is checked and enable them back when it gets unchecked. I tried StyleInfo.Enabled and StyleInfo.Clickable properties. They work fine initially i-e when Form Loads, but once the Grid combos become enable dropdowns don''t seem to get disabled. It visually shows that combo is disabled though. Maqsood Ahmed Kolachi Advanced Technologies http://www.kolachi.net

Administrator [Syncfusion]
Replied On October 25, 2004 04:46 AM UTC

1) So, there is no corresponding column in the main DataTable that matches the value column from the combobox datatable? If this is the case, one way to do this is to treat the extra column in the main grid as an unbound column and provide the data for this column in a grid.Model.QueryCellInfo event handler. There is a sample at the end of this thread. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=20373 If there is a corresponding column in the main to match the value column from teh combo table, then things should just work. Compare your code to the designer generated code in teh grid\samples\databound\GDBGcombos sample to see if you can spot the difference. If you cannot, post a sample here so we can see what you are doing. 2) grid.CurrentCellSHowingDropDown and grid.CurrentCellShowedDropDown. 3)You are setting these properties on the grid.GridBoundColumns[????].StyleInfo or the grid.Binder.InternalCOlumns[????].StyleInfo objects, correct? Is your code being hit? Where are you trying to do this? You might try the grid.CheckBoxClicked event.

Maqsood Ahmed
Replied On October 26, 2004 02:04 AM UTC

There is a column in the main datatable that will be populated on the basis of value selected from the ComboBox. I have succeeded to set value in main column but still CellText gets disappeared. I am displaying Hierarchical data on the grid with ComboBoxes on parent records only. I have also observed that whenever I select any value from ComboBox, all expanded records collapse :(. I have System.Windows.Forms.CheckBox (not Syncfusion CheckBox) and I want to disable combos when that checkbox is checked. One more thing, all records collapse at sorting, is there anyway to prevent this behaviour???

Administrator [Syncfusion]
Replied On October 26, 2004 05:47 AM UTC

>>I have also observed that whenever I select any value from ComboBox, all expanded records collapse :(. This suggests to me that the combobox and main grid may be bound to the same datasource in the same BindingContext, as the grid is responding to the ListChanged events from the combobox. Here is a sample that has a databound combobox in the root level of a hierarchical GridDataBoundGrid, and it does not display this behavior for me. What are you doing differently? HierarchicalCombos_4651.zip As far as preserving the expand state through a sort, then you will handle to handle this yourself. (If you use the GridGroiupingCOntrol, this is handled for you.) Here is a forum thread that has a sample of how you can do this with a GridDataBoundGrid. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=5172

Maqsood Ahmed
Replied On October 27, 2004 07:28 AM UTC

Thanks for your help. I have resolved all problems, but I am still unable to Disable Grid ComboBoxes when I Check System.Windows.Forms.CheckBox... and enable it vice versa. Any help in this regard will be appritiated.

Administrator [Syncfusion]
Replied On October 27, 2004 07:44 AM UTC

You need to handle the grid.Model.QueryCellInfo event. In your handler, if e.Style.CellType == "ComboBox" and your checkBox on your form is checked, then set e.Style.Enabled = false.

Administrator [Syncfusion]
Replied On October 27, 2004 07:48 AM UTC

Or another way you could do this is to handle the checkbox''s CheckedChanged event. There explicitly set grid.GridBoundColumns["myComboColumn"].StyleInfo.Enabled to be true or false depending upon the value of the checkbox. (If you have not explicitly added GridBoundColumns to your grid, then you would use grid.Binder.InternalCOlumns["myComboColumn"].StyleInfo.Enabled instead of grid.GridBoundCOlumns.)


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

Live Chat Icon For mobile
Live Chat Icon