views:

372

answers:

2

Hi,

I am trying to get the dataset in RowCommand event. Like this

DataTable dt = (DataTable)(gvImages.DataSource);
DataTable dtChanges =  dt.GetChanges(DataRowState.Modified);

But i am getting my dataTable NULL.

Can any one help me to find the modified rows in RowCommand event???

A: 

See the answers to this question. Basically, the underlying datasource used by a GridView is not saved in the view state, which means it is unavailable during a post back. If you need access to the data source, you must cache it yourself.

Jason Berkan
+1  A: 

Store the Datatable in the Session or ViewState. Retrieve it and modify it based on user selected row and change then save back to session. On the Rowcommand you will be able to retrieve the changes because they will be stored in the session/viewstate.

Jordan Johnson