让控件不可见,而且不占网页位置,那就是在客户端html脚本里面也找不到此控件,明显使用Visible = false是不行的。
所以必须使用 style="display:none;" 才可以,如果你的label是存在于GridView第一列中,你可以这样设置:
      #region 隐藏gridview不需要显示的列
        protected void gdvRecords_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            e.Row.Cells[0].Attributes.Add("style ", "display:none ");        }
        #endregion

本文转载:CSDN博客