GridView的AutoGenerateSelectButton="True"
如何隐藏这一列,现就是"选择列":用以下事件来处理
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[0].Attributes.Add("style", "display:none");
               
            }  
        }
出现Head部份无法隐藏
应该怎么也把Head的选择列也隐藏掉??

解决方案 »

  1.   

     if (e.Row.RowType == DataControlRowType.DataHeader) 
                { 
                    e.Row.Cells[0].Attributes.Add("style", "display:none"); 
                  
                }  
      

  2.   

    if (e.Row.RowType == DataControlRowType.Header) 
                { 
                    e.Row.Cells[0].Attributes.Add("style", "display:none"); 
                  
                }  
      

  3.   

    这个应该是在哪个事件里面???
    在GridView1_RowDataBound里面不行
      

  4.   

    “System.Web.UI.WebControls.DataControlRowType”并不包含“DataHeader”的定义
      

  5.   

    问题解决:
    if (e.Row.RowType == DataControlRowType.Header) 
                { 
                    e.Row.Cells[0].Attributes.Add("style", "display:none"); 
                  
                }  
      

  6.   

    GridView1.Columns[1].Visible = true;
    GridView1.Columns[1].Visible = false;