获取gridview中的label的id
2个回答
展开全部
1,你可以在gridview的RowDataBound事件里写:
Label lbl = (Label)e.Row.FindControl("你label的id");
string id = lbl.ID;
2.循环gridview从而得到
for (int i = 0; i < this.gridview.Rows.Count; i++)
{
Label lbl = (Label)this.GVmain.Rows[i].FindControl("你label的id");
string id = lbl.ID;
}
不建议去查看源文件获得
Label lbl = (Label)e.Row.FindControl("你label的id");
string id = lbl.ID;
2.循环gridview从而得到
for (int i = 0; i < this.gridview.Rows.Count; i++)
{
Label lbl = (Label)this.GVmain.Rows[i].FindControl("你label的id");
string id = lbl.ID;
}
不建议去查看源文件获得
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询