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

2 posts, 0 answers
  1. ShareDocs
    ShareDocs avatar
    91 posts
    Member since:
    Oct 2012

    Posted 28 May 2013 Link to this post


    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?


     



  2. Anton
    Admin
    Anton avatar
    167 posts

    Posted 31 May 2013 Link to this post

    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?
Back to Top