Is there a way to programatically change the SelectedIndex of a ComboBox in a GridDataBoundGrid? I need to do this to reflect data returned from the database. I am using beta version 126.96.36.199.
ADAdministrator Syncfusion Team March 3, 2004 07:23 AM
The grid really does not track ''the selected index''. The only thing its knows is the cell value. The selected index is only around when the dropdown is visible (and just before and just after).
Here is a kb link showing how you can get at the selected index as the combobox closes.
You can use similar code in CurrentCellShowingDropDown or CurrentCellShowedDropDown to get at the selected index. But when there is no combobox dropped or about to be dropped or closed, then there is no ''selected index'' available.
CRChris RMarch 5, 2004 08:27 AM
So how do I programatically set the values of those combobox cells from the info I get from the database?
ADAdministrator Syncfusion Team March 5, 2004 09:23 AM
In a GridDataBoundGrid, you do not have to do anything to get the cell values to reflects the values from teh database other than setting the DataSource on the grid.
Then the column in the grid where the comboboxes are should have whatever values were in the column from the grid''s DataSource.
Are you setting gridboundcolumn.StyleInfo.DataMember and gridboundcolumn.StyleInfo.ValueMember for this combobox column? If so, and you later want to set a value programatically to this column, then you should set the Text property of the style to some appropriate ValueMember value, ie. this.grid[row,col].Text = somethingFromTheValueMembers; in the columns DataSource.
If that does not help, can you explain exactly what you need to do?