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.
Syncfusion Feedback

GridGroupingControl (DirtyRows or storing RecordID''s)

Thread ID:





82287 Jun 8,2009 02:59 PM Jun 16,2009 09:45 AM Windows Forms 3
Tags: GridControl
Jason Lui
Asked On June 8, 2009 02:59 PM


What I'm attempting to is trying to keep track of user changes to the grid (grid grouping control). Does the grid control keep a cache of all the records changed (i.e. list of dirty records)?

If not, what I have tried to do is store the record ID's that have changed, but I cannot find a way to retrieve the record using that ID (not the row index). The reason I'm using ID and now RowIndex is that RowIndex can change on sort. I could also just try to get the record from the data source, but don't know how.

Any help?

Jisha Joy [Syncfusion]
Replied On June 9, 2009 07:16 AM

Hi Jason,

Gridgroupingcontrol does not keep track of all the records changes. 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.


Administrator [Syncfusion]
Replied On June 9, 2009 01:49 PM

I'm using the following callback to keep track of dirty rows:

private void gridGroupingControlMain_SourceListRecordChanged(object sender, Syncfusion.Grouping.RecordChangedEventArgs e)
if (_dirtyRecordIds.Contains(e.Record.Id) == false)
{ _dirtyRecordIds.Add(e.Record.Id); }

As you can see I'm just keeping track of the Record.Id's which does not change (from what I can tell) when the rows get sorted. Is there anyway I can use this Record.Id to retrieve the Record item from the GGC? Or is there some other way I can keep track of dirty records and retrieve them easily?

Lingaraj S [Syncfusion]
Replied On June 16, 2009 09:45 AM

Hi Jason,

Thank you for the update.

If you want to get a record from the Record Id value, then please try using Table.Records collection in GridGroupingControl to achieve this behavior. The Records collection are maintained the Records the records in GridGroupingControl.

Please refer the code below:

public Record GetRecordFromId(int id)
foreach (Record rec in this.gridGroupingControl1.Table.Records)
if (rec.Id == id)
return rec;
return null;

Let me know if you have any queries.

Lingaraj S.


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.

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