views:

282

answers:

1

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 :)

A: 

Hi, Try using the grid's UpdateCommand event handler. The event argument object that's coming into it contains a reference to the editform item. From there you can extract the newly-entered values and pass them to the ObjectDataSource:

Hashtable newValues = new Hashtable(); ((GridEditableItem)e.Item).ExtractValues(newValues);

//now the newValues hash table contain key/value pairs for each column field.

Hope it helps.

tsutso
From here I need to set things as default parameters on the ODS, what I was looking for was a way of injecting values into something like this hashtable and have it seamlessly passed on to the ODS. But I'm assuming this isn't possible.
Brent