简体   繁体   中英

Gridview rowcommand after refreshing

I have a gridview inside an updatepanel. After updating the gridview, accessing the individual rows does not seem to give the right row. For example:

 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow);

Row from the above code gives the values from the gridview before the gridview is refreshed/updated. Anyone knows how to get the updated values?

Try using the following to get a row index.

e.CommandArgument


Here is a good reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM