后台再gridview的RowDataBound中获取模板列中的图片控件即能的到对象。什么就可以解决不是吗? protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button lbl = e.Row.FindControl("Label1") as Button;//只是一个Button的演示,你可以换成你自己的
string mes = "alert('" + lbl.Text + "');";
ClientScript.RegisterStartupScript(typeof(string), "", mes, true);
}
}
最简单的办法将img控件放在一个pannel里直接pannel.Enable=false/ture
是按钮事件中 gridview.Columns[i].Visible = falseRowDataBound 事件中 e.Columns[i].Visible = false
试试在前台绑定其Visble属性