Monday, April 14, 2014

ASP.NET Find Control in Gridview

foreach (GridViewRow row in gvTest.Rows)
{
 var id = ((HiddenField)row.Cells[1].Controls[3]).Value;
 var rowIndex = row.RowInex;

}

Cells[] is start from 0, boundField is count but you cannot get the Controls.

Controls[] is start from 1,3,5,7

How to get it ?
Put Break Point at the code > Debug > "Immediate Window" > row.Cells[1].Controls[1].ClientID

No comments:

Post a Comment