Hello everyone,
Is there a snippet of code that allows you to cancel out of the update (or delete, add, etc) transaction inside the OnItemCommand? I would first like to show an alert box, focus on a textbox, and leave the page as it is without updating it.
I am doing this using a grid with inline editing, ajax enabled.
Here is my code behind:
Is there a better way of doing the exact same logic as above? If there is, please let me know too!
Thanks!
Is there a snippet of code that allows you to cancel out of the update (or delete, add, etc) transaction inside the OnItemCommand? I would first like to show an alert box, focus on a textbox, and leave the page as it is without updating it.
I am doing this using a grid with inline editing, ajax enabled.
Here is my code behind:
| Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) |
| If ((e.CommandName = "Update") AndAlso (TypeOf e.Item Is GridEditableItem)) Then |
| Dim editeditem As GridEditableItem = CType(e.Item, GridEditableItem) |
| Dim txtName As TextBox = CType(editeditem("NameColumn").Controls(0), TextBox) |
| If txtName.Text = "" Then |
| Utils.ShowMessage("Please enter a value for the name.", Page) |
| txtName.Focus() |
| ' Cancel out of update transaction |
| End If |
| End If |
Is there a better way of doing the exact same logic as above? If there is, please let me know too!
Thanks!