隐藏GridView列

不知是不是微软的一个BUG ,DataGrid 可以直接设某列的Visible=false.
但如果在GridView中把Visible=false就找不到这一列.
解决方法是在GridView的 RowDataBound 方法中动态把某列的Visible=false

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
 
{

        
if (e.Row.RowType == DataControlRowType.DataRow)
       
{
           e.Row.Cells[
8].Visible = false//status
           e.Row.Cells[9].Visible = false//rqId
           e.Row.Cells[10].Visible = false;//rqType
       }

}
原文地址:https://www.cnblogs.com/King0502/p/2019310.html