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

Access/update item values before ODS event handler

3 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brent
Top achievements
Rank 1
Brent asked on 15 Jun 2010, 04:44 AM
Hi there,

I need to update some of the values of the item being edited in my code-behind based on some values in a custom Edit Form on our Rad Grid. Can I access the item (and update some values) from one of the Grid's event handlers? Currently I'm storing the values in temporary variables and then injecting the new values in the ObjectDataSource's Inserting/Updating event handlers, but it would be much nicer if I could do it all in one spot. (I can't do it all in the ObjectDataSource event handlers as I can't access the controls inside my Grid's Edit Form.)

I've been playing with the ExtractValues and UpdateValues methods of the GridEditableItem object, but I'm not having any luck.

Any tips would be greatly appreciated :)

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 18 Jun 2010, 07:12 AM
Hi Brent,

Try handling the UpdateCommand/InsertCommand or ItemCommand event of RadGrid for your purpose. You can find the below articles for more information on how to get new values there in the below articles:

http://www.telerik.com/help/aspnet-ajax/grdupdatinginplaceandeditforms.html
http://www.telerik.com/help/aspnet-ajax/grdinsertingvaluesinplaceandeditforms.html

Kind regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Brent
Top achievements
Rank 1
answered on 18 Jun 2010, 08:26 AM
Hi Iana,

Thanks for your reply, but it's not quite what I'm looking for. We don't use DataTables to bind our grids, so we can't edit the rows like that.

What I'm hoping for is something like the e.InputParameters property available in the Inserting/Updating/Deleting event handlers for ObjectDataSources.

If this is possible, please let me know.

Cheers!

Brent
0
Iana Tsolova
Telerik team
answered on 23 Jun 2010, 01:16 PM
Hi Brent,

The grid events do not have access to the data source control parameters. However on UpdateCommand/InsertCommand you can still set values to the datasource controls parameter. For instance using the below syntax:

ObjectDataSource1.UpdateParameters["ID"].DefaultValue = 1;

I hope this helps.

Sincerely yours,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Brent
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Brent
Top achievements
Rank 1
Share this question
or