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. Image for the cookie policy date

GridDataBoundGrid - How to get value of ComboBox in different column

Hi,

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?

1 Reply

AD Administrator Syncfusion Team October 3, 2006 05:01 AM UTC

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 );
}

Thanks,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon