Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
930
Can you undo DeleteRow server-side?
posted

 I have a client-side script that deletes a row in my grid. I handle the following DeleteRow event with a server-side method. Is it possible to cancel the deleting of the row, and bring the row back in the grid server-side, without reloading the grid completely? I've tried setting e.Cancel = true; but that doesn't do the trick.

Parents
  • 45049
    posted

    I don't believe that you can cancel row deletion in server side code without essentially re-binding the grid.

    The way I'd do this is to simply not delete the row from my underlying data source in the grid's DeleteRow event under the appropriate circumstances.  I'd also handle the grid's UpdateGrid event (raised once per postback after all add/update/delete events are processed) and re-bind my grid to the data source.  This would account for all the changes that I didn't undo, but wouldn't apply this row deletion since I never deleted it from the data source.

    I don't believe that this approach will work if you're using the grid's built-in AJAX functionality, however.  This is because the grid only passes back and forth information about the individual row that was affected, and since the row was already deleted in the client, it wouldn't be recreated.

Reply Children