简体   繁体   中英

How to retrieve row index in gridview

gridview选择领域时如何检索行索引

GridView.FindControl("lblReqId").rowIndex;
var ctrl = GridView.FindControl("lblReqId");
var idx = GridView.Controls.IndexOf(ctrl);

You cannot get the RowIndex if this control is existing in each row cell of GridView . You might need to use events that fires for each row and in those event you can get RowIndex and ultimately your control lblReqId with reference to that Row .

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