简体   繁体   中英

Nested gridview get outer gridview row index on inner gridview footer button click

I have a nested gridview with a add button in the footer of one column and a textbox in the footer of another column. When I click the add button, it would add a row into the nested gridview with the value that was entered in the textbox. I am trying to figure out how to get the row index of the outer gridview in the add button click function.

Or is there a better way to accomplish what I have described above in general?

In the onclick event do:

                                    //Button Row    //GridView      //Parent row
var parentRow = (GridViewRow)sender.NamingContainer.NamingContainer.NamingContainer;
var index = parentRow.RowIndex;

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