Finding a Record from DataRow

I am using a GridGroupingControl. I use a DataTable as the DataSource for this grid. Is there a direct way of finding the Syncfusion Record from the DataRow of that DataTable?

1 Reply

RC Rajadurai C Syncfusion Team May 18, 2009 02:14 PM UTC

Hi Phani,

Thanks for your interest in Syncfusion products.

Please refer to the following code showing how to get the record value from the underlying data handled in QueryCellStyleInfo event.

void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
GridRecord record = e.TableCellIdentity.DisplayElement.GetRecord() as GridRecord;
if (record != null)
{
//to get the raw dataobject, ie the DataRowView from a DataTable datasource
//you can use
object data = record.GetData();
DataRowView drv = data as DataRowView;
if (drv != null)
{
Console.WriteLine("field0={0} field1={1}", drv[0], drv[1]);
}
}
}


Regards,
Rajadurai

Loader.
Up arrow icon