zoukankan      html  css  js  c++  java
  • Asp.Net GridView 的e.Row.Cells[0].Text为什么取不到值?

     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的各字段转化成了模板

  • 相关阅读:
    docker tar 镜像 容器相互转换
    JavaScript执行上下文
    JavaScript 作用域
    原型与原型链
    使用Navicat for Oracle新建表空间、用户及权限赋予
    PL/SQL Developer使用教程(中文)
    一步一步使用bootstrap开发一个博客模板
    How to create a simple blog using ASP.NET MVC
    一个有意思的编程网站
    一个很好的java编程国外网站
  • 原文地址:https://www.cnblogs.com/liuzhengdao/p/1273915.html
Copyright © 2011-2022 走看看