protected void gvUserInfo_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((LinkButton)(e.Row.Cells[7].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
        }
    }
帮我解释一下这句!!!

解决方案 »

  1.   

    asp.net?加入html标签的属性值像<input ***** > asdf</input>
    加完就变成
    <input onclick=“return confirm('确定删除吗?')” ***** > asdf</input>
      

  2.   

    添加客户端属性,就这个例子而言,是为GridView中第8列的LinkButton添加onclick属性
      

  3.   

    给当前行的,第8个单元格的控件 强制转换成LINKBUTTON然后添加单击事件,弹出判断提示窗口:'确定删除吗?'
    但是如果单元格不是linkbutton,那就会出”未将对象设置引用到实例了“!