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

  • 相关阅读:
    刷皇室成员
    python 2.7中matplotlib的所有版本
    Linux命令使用时路径存在空格、特殊符号
    路径名太长导致无法读取文件
    谷歌浏览器打包插件
    Upload 上载新生
    Linux的终端(base),进入base环境
    Ubuntu16.04系统语言设置为中文以及搜狗输入法的安装
    R语言3D图导出矢量图有bug
    将本地文件复制到hadoop文件系统
  • 原文地址:https://www.cnblogs.com/liuzhengdao/p/1273915.html
Copyright © 2011-2022 走看看