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.
Unfortunately, activation email could not send to your email. Please try again.

GridDataBoundGrid - How to get value of ComboBox in different column

Thread ID:





49918 Sep 29,2006 08:48 AM Oct 3,2006 01:01 AM Windows Forms 1
Tags: GridControl
Clive Hill
Asked On September 29, 2006 08:48 AM


When editing a cell in a GridDataBoundGrid, i need to get the value of the selected item in a ComboBox of a cell in a different column but same row. To do this I assume I need to get a reference to GridComboBoxCellRenderer.

I can''t see how to get this reference. I can get the GridStyleInfo like:

GridStyleInfo style = dataGrid[cc.RowIndex,cc.ColIndex-1];

but the GridComboBoxCellRenderer?

Administrator [Syncfusion]
Replied On October 3, 2006 01:01 AM

Hi Vito,

You can use the GetCellRenderer method to get the reference to the GridComboBoxCellRenderer in a grid and use the ListBoxPart.SelectedItem property to get the selected item of the combo box cell. Below is a code snippet

GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
GridStyleInfo style = this.gridDataBoundGrid1.Model[cc.RowIndex,5];
GridComboBoxCellRenderer cr = this.gridDataBoundGrid1.GetCellRenderer( cc.RowIndex,5) as GridComboBoxCellRenderer;

if( cr != null)
DataRowView row = cr.ListBoxPart.SelectedItem as DataRowView;
Console.WriteLine( ":::"+ row[0] + ">>>" + style.CellValue );



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.

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.