ImageButton 控件放在templatefield中
在.cs文件中
ImageButton imgbtn = (ImageButton)e.Row.FindControl("imgbtnDelete");
为什么找不到,是模板列的原因吗????????
在.cs文件中
ImageButton imgbtn = (ImageButton)e.Row.FindControl("imgbtnDelete");
为什么找不到,是模板列的原因吗????????
TextBox txt=gvr.FindControl("txt") as TextBox;
foreach(GridViewRow gr in GridView1.Rows)
{}//FindControl
你可以在执行出来的页面里“查看源代码”,你会看到你的控件的ID并不是你后台代码所写的ID
如果你要取得控件的ID的话,我想你必须是先得到具体某一行的记录后才有可能通过FindControl找到控件