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

Set Data/Perform Custom Operation Before Automatic Insert/Update/Delete

3 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 23 Oct 2012, 07:47 AM
How do I set data and/or perform custom operations when using the "AllowAutomaticUpdates" (Inserts/Deletes) property?

I note the "ItemInserted" and "ItemUpdated" events occur, but what about "ItemInserting" or "ItemUpdating" etc?

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Oct 2012, 06:18 AM
Hi Peter,

The automatic data source operations only work when binding the grid to a declarative data source using the DataSourceID property of the grid. You must configure the data source so that it supports the automatic operations. You also need to set the DataKeyNames property of the table views in the grid so that the insert, update, and delete operations perform as expected. Check the following help documentation which explains more about this.
Automatic DataSource Operations

Thanks,
Princy.
0
Peter
Top achievements
Rank 1
answered on 25 Oct 2012, 06:21 AM
I understand - but is there any event where I can interact with the data before it is saved? E.g. set some additional data behind-the-scenes?
0
Eyup
Telerik team
answered on 25 Oct 2012, 03:53 PM
Hi Peter,

You could use ItemInserting/Updating server event if it suits your specific scenario.

Generally, I could suggest you to use ItemCommand event and use e.Canceled on some condition. Then after performing some logic, you could enable the condition and fire an Update/PerformInsert command as demonstrated in the following topic:
http://www.telerik.com/help/aspnet-ajax/grid-fire-command-event-from-code.html

I hope this will prove helpful.

Regards,
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.
Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Peter
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or