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

Getting edit form data from ItemCommand handler

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 29 Aug 2008, 02:53 PM
I'll try to make this as brief as possible. I've got a ajaxified grid among many others in a radmulitpage and radtab. That's not the problem.

I have one grid bound to a collection. The  EditFormType is AutoGenerated, and it's a popup. AllowAutoInsert/Update/Delete is turned off. I'm trying to handle all actions through the ItemCommand event, where I can just check the CommandName and do the appropriate actions. Through trial and error I've gotten most other commands to work, such as "Delete", "DeleteSelected", "Edit", etc...

The problem is with trying to access the new edit form fields on the "Update" and "UpdateEdited" commands. I don't allow mulit row edit. I've tried to cast every which way to get to these new form fields. I only can get the old values by doing this:

string newFirst = ((GridDataItem)RadGrid1.EditItems[0])["FirstName"].Text.Trim();


I use EditItems[0] because again I'm allowing only one row to be edited and I do validation anyway. This get's me the right row but it's the value before it's edited. What's the best way to access the edited form values. Can I get it through accessing the GridCommandEventArgs or the RadGrid instance? What's the easiest and best way?

Sorry to be longwinded... there's probably an easy explanation.

Thanks,
Brad

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 29 Aug 2008, 03:25 PM
Hello Brad,

I would suggest you to use the ExtractValuesFromItem method. Please review the following help article and online demo:

http://www.telerik.com/help/aspnet-ajax/grdupdatinginplaceandeditforms.html
http://demos.telerik.com/aspnet/prometheus/Grid/Examples/DataEditing/EditModes/DefaultCS.aspx

Kind regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Brad
Top achievements
Rank 1
Answers by
Missing User
Share this question
or