thanks, actually I don't really want to invisible it. It is because I want
to put a value for each row but make it hide away. Just like what we did
in windows programming for adding a value for each row. If I make the
column in asp:GridView invisible, I cannot get the value from that column.
Ah... You've discovered the additional security feature that a GridView has
but a DataGrid didn't.
Basically, Microsoft took the view that using hidden columns to store data
was a potential security risk, so they removed hidden colums from ViewState
at databind time. However, it's easy enough to work round, but be aware of
the potential security risk involved in doing this...
MyGridView.DataSource = <datasource>;
MyGridView.Columns[0].Visible = true;
MyGridView.DataBind();
MyGridView.Columns[0].Visible = false;