I have a gridview that uses autogenerated columns, because the user can select the columns to return in a query. I want to hide the column with the identity. How do I hide the autogenerated column? Even in the databound event the columns count is zero.
I discovered how to do this. You need to use the rowdatabound event and hide the cell when the row is bound.
Protected Sub ResultGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles ResultGrid.RowDataBound
e.Row.Cells(1).Visible = False
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With