Getting the Databound object out from a GridView
-
Hello, I am using a GridView in combination with an ObjectDataSource. What I am after is a method to call (eg, after the row has been edited), which will return the values bound to the DataObject (i.e. the object that was passed in, or the object that is defined by the
ObjectDataSource.DataObjectTypeName
property). Currently, such a method is available when hooking into the RowDataBound action. The propertyGridViewRowEventArgs.Row.DataItem
returns the values that have been bound as a DataObject. I would like to be able to call such a method when I am responing to postbacks (ie, from a button). I have looked atGridView.Rows[_index_].DataItem
, but that always seems to be null. Any hint in right direction is appreciated. Cheers -
Hello, I am using a GridView in combination with an ObjectDataSource. What I am after is a method to call (eg, after the row has been edited), which will return the values bound to the DataObject (i.e. the object that was passed in, or the object that is defined by the
ObjectDataSource.DataObjectTypeName
property). Currently, such a method is available when hooking into the RowDataBound action. The propertyGridViewRowEventArgs.Row.DataItem
returns the values that have been bound as a DataObject. I would like to be able to call such a method when I am responing to postbacks (ie, from a button). I have looked atGridView.Rows[_index_].DataItem
, but that always seems to be null. Any hint in right direction is appreciated. CheersAlthough I'm not entirely certain have a look at the ObjectDataSource's OnUpdated event. There should be arguments passed to that to allow you retrieve the data.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton -
Hello, I am using a GridView in combination with an ObjectDataSource. What I am after is a method to call (eg, after the row has been edited), which will return the values bound to the DataObject (i.e. the object that was passed in, or the object that is defined by the
ObjectDataSource.DataObjectTypeName
property). Currently, such a method is available when hooking into the RowDataBound action. The propertyGridViewRowEventArgs.Row.DataItem
returns the values that have been bound as a DataObject. I would like to be able to call such a method when I am responing to postbacks (ie, from a button). I have looked atGridView.Rows[_index_].DataItem
, but that always seems to be null. Any hint in right direction is appreciated. Cheers