There may be a time where you want to hide a GridView Column from a user but still need to access the data bound to the particular column.
Use CSS and apply it to the BoundField’s ItemStyle:
<style type="text/css"> .hiddencol { display:none; } </style>
<asp:GridView ID="gvWorkActivitySelections" runat="server" AutoGenerateColumns="False" EnableModelValidation="True" OnRowCommand="ChoicesUpdate" ShowHeader="False"> <Columns> <asp:ButtonField ButtonType="Button" Text="Remove" CommandName="remove" /> <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /> <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" > <ItemStyle CssClass="hiddencol" /> </asp:BoundField> </Columns> </asp:GridView>
More Info