//控件是是行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//奇数和偶数行是编辑状态
if (e.Row.RowState == DataControlRowState.Edit ||
e.Row.RowState == (DataControlRowState.Alternate | DataControlRowState.Edit))
{
//在满足条件的行中找控件
DropDownList ddlReadiness = e.Row.FindControl("drpListNominationTime") as DropDownList;
Label lblReadiness = e.Row.FindControl("lblReadiness") as Label;}
}
//是GridView头部行,可以实现全选与全部选功能 checkbox
if (e.Row.RowType == DataControlRowType.Header)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
for (int j = 0; j < e.Row.Cells[i].Controls.Count; j++)
{
if (e.Row.Cells[i].Controls[j] is CheckBox)
{
CheckBox chk = (CheckBox)e.Row.Cells[i].Controls[j];
chk.Attributes.Add("onclick", "ClickCheckAllItem(this)");
}
}
}
}