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

Programatically Setting SelectedIndex of ComboBox in GDBG

Thread ID:





11347 Mar 3,2004 11:36 AM UTC Mar 5,2004 02:23 PM UTC WinForms 3
Tags: GridControl
Chris R
Asked On March 3, 2004 11:36 AM UTC

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 Thanks, Chris

Administrator [Syncfusion]
Replied On March 3, 2004 12:23 PM UTC

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. http://www.syncfusion.com/Support/article.aspx?id=10421 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.

Chris R
Replied On March 5, 2004 01:27 PM UTC

So how do I programatically set the values of those combobox cells from the info I get from the database?

Administrator [Syncfusion]
Replied On March 5, 2004 02:23 PM UTC

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?


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