protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
       
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton bt = new LinkButton();
            bt = (LinkButton)e.Row.Cells[0].FindControl("LinkButton_GuoZhang");
            bt.CommandArgument = e.Row.Cells[0].Text;
            bt.Enabled = false;
            if (e.Row.Cells[11].Text == "0")
                bt.Enabled = true;
            bt = (LinkButton)e.Row.Cells[0].FindControl("LinkButton_HuiChong");
            bt.CommandArgument = e.Row.Cells[0].Text;
            bt.Enabled = false;
            if (e.Row.Cells[11].Text == "1")
                bt.Enabled = true;
            bt = (LinkButton)e.Row.Cells[0].FindControl("LinkButton_Del");
            bt.CommandArgument = e.Row.Cells[0].Text;
            bt.Enabled = false;
            if (e.Row.Cells[11].Text == "0")
            {
                bt.Enabled = true;
                bt.Attributes.Add("onclick", "javascript:if(confirm('您确定要删除吗?')==false) return false;");
            }
        }

    }

 

 

 原因是你将Gridview1的各字段转化成了模板

 

相关文章:

  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2021-11-21
猜你喜欢
  • 2022-02-28
  • 2021-12-20
  • 2021-11-25
  • 2021-11-22
  • 2022-12-23
  • 2021-07-19
相关资源
相似解决方案