I have a GridView
How do I get a value of a column for a given row.
I tried the following but it only gives the row number instead of the value:
int selRowIndex = ((GridViewRow)(((System.Web.UI.WebControls.CheckBox)sender).Parent.Parent)).RowIndex;
you are looking for the contentnot the index
var cellText= ((GridViewRow)(((System.Web.UI.WebControls.CheckBox)sender).Parent.Parent)).Cells[0].Text;
and then convert it to int
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.