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

How to find row using GridStyleInfo in cellmodel?

I want to customize the contents of datasource for my GridComboBox cell depending on a value in the same row. For example if productType field is 1, combobox should display values a,b,c; if productType is 2, then it should display c,d,e and so on. I''m trying to do this by extending the GridComboBoxCellModel and overriding the GetDataSource(GridStyleInfo info) method. Currently my problem is that I can''t figure out how to get hold of the current row so that I could read the value from the "productType" column. I can get the rowIndex from styleInfo, but don''t know what I should do with it. I''m using GridGroupingControl.

1 Reply

AD Administrator Syncfusion Team February 13, 2005 11:50 AM

Try casting the GridStyleInfo to a GridTableStyleInfo object. Once it is a GridTableStyleInfo, you can try to get the GridRecordRow, and from there get at the for for the row.
GridTableCellStyleInfo tStyle = style as GridTableCellStyleInfo;
if(tStyle != null)
{
	GridRecordRow grr = tStyle.TableCellIdentity.DisplayElement as GridRecordRow;
	if(r != null)
	{
		DataRowView drv = grr.GetData() as DataRowView;
		if(drv != null)
		{
			Console.WriteLine(drv["Col1"]);
		}
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon