zoukankan      html  css  js  c++  java
  • gridview隐藏某一列

    gridview隐藏某一列,以前VS2003的用法gridview.columns[index].visible=false;

    现在在ASP.NET中此方法隐藏主键列时行不通了

     //分页的grideview隐藏主键列

      protected void gvProductList_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                //gvProductList.Columns[0].Visible = false;//此方式在ASP.NET隐藏主键列是会出现问题

               //用gridview自带的分页功能进行判断隐藏主键列
                if (e.Row.RowType != DataControlRowType.Pager)
                {
                    e.Row.Cells[0].Visible = false;
                }

              //确定是否删除某一行
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    ((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除:\"" + ((HyperLink)e.Row.Cells[1].Controls[0]).Text + "\"吗?')");
                }

            }

  • 相关阅读:
    自定义样式滚动条
    html文本超出加省略号
    getcomputedstyle和style的区别
    模块化设计
    js数组取出非重复元素
    vue 获取元素高度
    js 滚动条滑动
    swiper基本使用
    flex弹性盒子布局
    js 地区三级联动 2
  • 原文地址:https://www.cnblogs.com/peak/p/1445545.html
Copyright © 2011-2022 走看看