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

Finding the correct record

Thread ID:





74644 Jun 23,2008 09:11 PM UTC Jun 27,2008 04:12 PM UTC ASP.NET Web Forms (Classic) 2
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On June 23, 2008 09:11 PM UTC


I need to get the correct record from a cell but offsets are making this difficult. For example:

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
int rowIndex = e.Style.TableCellIdentity.RowIndex;
Record rec = this.GridGroupingControl1.Table.Records[rowIndex];

The above method has a fault: Rows containing column names or filterbar dropdowns etc, will add to the rowIndex.

What then is the best way to get a RowIndex from the cell? I need a method that is guaranteed to match the grid's RowIndex to the underlying DataTable's RecordIndex?

I could manually adjust the RowIndex (such as "e.Style.TableCellIdentity.RowIndex - 3") ... but then I am assuming the offset is always a fixed constant. Rather I need to find out at runtime how many rows are adding an offset and use that information to get the correct DataTable record.

Robert Claypool, Nashville, TN

Murali Samanthapudi
Replied On June 27, 2008 04:11 PM UTC

Hi Robert,

Thank you for using our libraries.

Inside QueryCellStyleInfo, you can get the underlying record object directly from the TableCellIndentity. You do not have to find indexes and then index another collection to get the record object. Here is some code showing how you can use the TableCellIdentity to get at the underlying data.

void gridGroupingControl1_QueryCellStyleInfo(object sender, 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]);

Please let us know if this is not the information you needed.


Clay Burch

Administrator [Syncfusion]
Replied On June 27, 2008 04:12 PM UTC

That is exactly what I needded. Thanks!


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