Monday, February 23, 2015

Make things happen at a DevExpress grid when pressing the cancel button while inline editing!

You need the AfterPerformCallback event.

MyGrid.AfterPerformCallback += MyGrid_AfterPerformCallback;

 
 

You may use it like so:

private void MyGrid_AfterPerformCallback(object sender, ASPxGridViewAfterPerformCallbackEventArgs e)
{
   if (e.CallbackName.Equals("CANCELEDIT"))
   {
      MyGrid.DataSource = GetEverythingAnew();
      MyGrid.DataBind();
   }
}

 
 

In my case I found that when I surfaced an exception within attempting to save an inline record like this that when I then pressed the cancel button that the row I was editing did not return to the way it was before. Instead, I saw the botched record with messed up values that I didn't save and though I had saved it. I didn't save it though, there was some caching nastiness. This fixes that.

No comments:

Post a Comment