How to hide a column (GridView) but still access its value?

后端 未结 13 1316
粉色の甜心
粉色の甜心 2020-11-27 17:52

I have a GridView with a DataSource (SQL Database). I want to hide a column, but still be able to access the value when I select the record. Can someone show me

13条回答
  •  不知归路
    2020-11-27 18:34

    When I want access some value from GridView before GridView was appears.

    1. I have a BoundField and bind DataField nomally.
    2. In RowDataBound event, I do some process in that event.
    3. Before GridView was appears I write this:

      protected void GridviewLecturer_PreRender(object sender, EventArgs e) 
      {
          GridviewLecturer.Columns[0].Visible = false;
      }
      

提交回复
热议问题