This is a migrated thread and some comments may be shown as answers.

Check if event was cancelled after calling client side updateItem

4 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hosney
Top achievements
Rank 1
Hosney asked on 04 Sep 2012, 07:07 AM
Is there a way to find out if the event was cancelled on the server after calling grid table view updateItem method from the client?

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 07 Sep 2012, 06:11 AM
Hello Hosney,

I am afraid it is difficult to figure out your exact scenario by the provided information so far. Could you please elaborate on what you want to achieve?

Generally, you could use the OnItemUpdated server event of RadGrid to check whether the update has been successfully performed as demonstrated in the following demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

I hope this will prove helpful.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Hosney
Top achievements
Rank 1
answered on 07 Sep 2012, 06:20 AM
I'm calling the following function from the client:

masterTableView.updateItem(editIndex);

Then I capture the OnUpdateCommand event on the server to perform the update. Here I do some validations and if the data is invalid i cancel the event by setting e.Canceled = true; (where e is the GridCommandEventArgs parameter)

What I'd like to know is if there is a method called back on the client after this where I can check if the UpdateCommand was cancelled.

I'm doing something similar to what can be found here:
http://mono.telerik.com/Grid/Examples/DataEditing/EditOnDblClick/DefaultCS.aspx

Only difference being that I do the saving manually inside the UpdateCommand event, and cancel the event based on the validity of the record. But cancelled or not the editedRow variable will be set to null and the next row click will not fire the updateItem function.
0
Accepted
Eyup
Telerik team
answered on 12 Sep 2012, 05:23 AM
Hi Mohamed,

I am afraid there is no a direct callback function when you cancel the update operation. Instead, you could fire a JavaScript function when you use e.Cancel= true or OnItemUpdated, which is being fired if the actual update has been performed:
ScriptManager.RegisterStartupScript(Page, typeof(Page), "myScript", "functionName()", true);

I hope this helps.

All the best,
Eyup
the Telerik team
0
Hosney
Top achievements
Rank 1
answered on 12 Sep 2012, 07:00 AM
I thought so. That's not so hard anyway. Thanks!
Tags
Grid
Asked by
Hosney
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Hosney
Top achievements
Rank 1
Share this question
or