开发者

Get DataSet in RowCommand event/Get modified rows in RowCommand

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

D开发者_C百科ataTable dt = (DataTable)(gvImages.DataSource);
DataTable dtChanges =  dt.GetChanges(DataRowState.Modified);

But my dataTable returns NULL.

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜