This is a migrated thread and some comments may be shown as answers.

cant grip (grid.datasource as DataTable).GetChanges()

1 Answer 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ShareDocs
Top achievements
Rank 1
ShareDocs asked on 28 May 2013, 08:55 AM

HI, I have a gridView (with DataTable as DataSource) and im trying to use the "GetChanges()" when the user change some data in the grid.

in order to use it I do this:
(grid.datasource as DataTable).GetChanges() 

I found out that when I change one cell in the gridView, and then click out of that row , the GetChange() gives me the changes as it should

but 

If I change one cell in the gridView, and then I click in another cell but in the same row. the GetChange() give me Null, like there where no changes.

The event grid_ValueChanged() is fired, but the (grid.datasource as DataTable).GetChanges() still giving null.

any solution?


 



1 Answer, 1 is accepted

Sort by
0
Anton
Telerik team
answered on 31 May 2013, 10:46 AM
Hi Lior,

Thank you for writing.

This behavior is normal and expected in this case. By design when you change the value of one cell and move to another cell in same row the EndEdit method is not called. This behavior allows the control to handle a lot of cases where users want to have control over the canceling of editing. However, if you want to change this behavior you can do that by explicitly calling the EndEdit method of RadGridView into the ValueChanged event. Consider the following example:
void radGridView1_ValueChanged(object sender, EventArgs e)
{
    this.radGridView1.EndEdit();
    DataTable table = (this.radGridView1.DataSource as DataTable).GetChanges();
}

I hope this helps.

Regards,
Anton
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
GridView
Asked by
ShareDocs
Top achievements
Rank 1
Answers by
Anton
Telerik team
Share this question
or