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
Canceling Webdatagrid updates

Hello all,

Can some one tell me how we can cancel all updates on webdatagrid (CRUD) ? Suppose that user had added some rows, removed others and updated any cells. After all this he decided to cancel all (To go to have lunch).

All what i know is to ovoid updates for adding and updating using RowAdding and RowUpdating server side events.Thank you very very much for your help


No Data
  • 40
    Offline posted

    I know this is a very old post, but I had the exact same problem and the posted solution seemed overly complicated for my needs.  I got this to work by doing the following:

    1. Behaviors/AutoCRUD = False

    2. Behaviors/BatchUpdating = True

    3. Handle the updates in the server side event RowUpdating.

    4. Placed a hidden field on the page called hdnSaveDataSched

    5. Placed 2 buttons on the page, one for SAVE and one for CANCEL.

    6. Created a little JavaScript Routine called updateSaveDataSched to set the value of the hidden field.

            function updateSaveDataSched(val) {
                document.getElementById("hdnSaveDataSched").value = val;

    7. Attached the following to the SAVE button.  btnSave.Attributes.Add("onClick", "updateSaveDataSched('y');")

    8 Attached the following to the CANCEL button. btnCancel.Attributes.Add("onClick", "updateSaveDataSched('n');")

    9. In the server side event RowUpdating, if the hidden field value is 'n' I exit the routine without performing the update.  If the value is 'y' I perform the database updates.

            If hdnSaveDataSched.Value = "n" Then
                Exit Sub
            End If

    10. VOILA!  It works!

No Data