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
Kolachi Advanced Technologies
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.
Kolachi Advanced Technologies
ADAdministrator Syncfusion Team October 24, 2004 11:46 PM
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.
MAMaqsood AhmedOctober 25, 2004 09:04 PM
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???
ADAdministrator Syncfusion Team October 26, 2004 12:47 AM
>>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?
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
MAMaqsood AhmedOctober 27, 2004 02:28 AM
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.
ADAdministrator Syncfusion Team October 27, 2004 02:44 AM
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.
ADAdministrator Syncfusion Team October 27, 2004 02:48 AM
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.)