Me.WebDataGrid1.Behaviors.EditingCore.EditingClientEvents.RowsDeleting = "WDG1_RowDeleting" Me.WebDataGrid1.Behaviors.EditingCore.EditingClientEvents.RowDeleted = "WDG1_RowDeleted"
this.WebDataGrid1.Behaviors.EditingCore.EditingClientEvents.RowsDeleting = "WDG1_RowDeleting"; this.WebDataGrid1.Behaviors.EditingCore.EditingClientEvents.RowDeleted = "WDG1_RowDeleted";
// The client event RowDeleting takes two parameters sender and e // sender is the object which is raising the event // e is the CancelRowsDeletingEventArgs var length = null; function WDG1_RowDeleting(sender, e) { //Returns the collection of rows that are about to be deleted var rows = e.get_rows(); //Returns the number of rows in the collection length = rows.get_length(); if (length == 1) { if (!confirm("Are you sure you want to delete the row?")) //Cancels 'RowDeleting' event e.set_cancel(true); } else { if (!confirm("Are you sure you want to delete the '" + length + "' rows?")) e.set_cancel(true); } } // The client event RowDeleted takes two parameters sender and e // sender is the object which is raising the event // e is the RowsDeletedEventArgs function WDG1_RowDeleted(sender, e) { var wdg = $find("WebDataGrid1"); //Returns the grid's behavior collection var behaviors = wdg.get_behaviors(); //Returns reference to the selection behavior var selection = behaviors.get_selection(); if (length == 1) { alert("Successfully deleted the row!"); } else alert("Successfully deleted the rows!"); }