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

GetChanges from the GroupingGridControl

Hi, If the user modifies data in the grid,I want to get modified rows. I am trying to get delta of the datatable bound to the GroupingGridControl. dt is a datatable, it is declared as a member variable to the class. I am using DataTable dtt = dt.GetChanges(DataRowState.Modified); But is returning undefined value. Thx, Prathima

4 Replies

AD Administrator Syncfusion Team May 30, 2005 08:00 AM

Are you leaving the changed row before you call GetChanges? The changes are only committed to the datasource when you leave the row. If you want to catch the changes on the current row, you can try calling the Validate method on the form before your GetChanges call.
private void button1_Click(object sender, System.EventArgs e)
{
	this.Validate();
	DataTabel t2 =	dt.GetChanges(DataRowState.Modified);
	if( t2 != null)
	{
		Console.WriteLine(t2.Rows.Count);
	}
}


PV Prathima Venkobachar May 31, 2005 11:35 PM

Hi, I am attaching the sample I hv tried.Pl have a look at it. Thx, prathima >Are you leaving the changed row before you call GetChanges? The changes are only committed to the datasource when you leave the row. > >If you want to catch the changes on the current row, you can try calling the Validate method on the form before your GetChanges call. >
>private void button1_Click(object sender, System.EventArgs e)
>{
>	this.Validate();
>	DataTabel t2 =	dt.GetChanges(DataRowState.Modified);
>	if( t2 != null)
>	{
>		Console.WriteLine(t2.Rows.Count);
>	}
>}
>
GGC_MoveCOlumns_8e767f4c1_1090.zip


AD Administrator Syncfusion Team June 1, 2005 04:23 AM

In that sample, the Datatable was created dynamically with all the rows being added new. And DataTable.AcceptChanges was not called. So, the RowState for all the rows is Added, and will remain so event if you modify some rows. That is why GetChanges(Modified) is coming back empty in the sample code. So, try either adding the DataTable.AcceptChanges call so all rows will start out unmodified, or using GetChanges(Added) to get the changes.


PV Prathima Venkobachar June 1, 2005 04:36 AM

Thx for the reply. I used DataTable.AcceptChanges() and GetChanges(Modified). It works fine. But if I use GetChanges(Added)..it doesn''t work. Anyway what I need is working. Thx again. Prathima >In that sample, the Datatable was created dynamically with all the rows being added new. And DataTable.AcceptChanges was not called. So, the RowState for all the rows is Added, and will remain so event if you modify some rows. That is why GetChanges(Modified) is coming back empty in the sample code. So, try either adding the DataTable.AcceptChanges call so all rows will start out unmodified, or using GetChanges(Added) to get the changes.

Loader.
Live Chat Icon For mobile
Up arrow icon