How do you hide a column for a DataBound GridView
I found this solution on http://www.beansoftware.com/ASP.NET-Tutorials/GridView-Hidden-Column.aspx and it was not as easy to find as you would think. I saw people suggesting the obvious like set the Visible property of the Column to false or (the less obvious) set the width of the column to 0. None of these work for a DataBound GridView.
The way to hide a column in a DataBound GridView is to trap the RowCreated Event and set a Cell inside the column of the row to Visible = false. Nice!
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
// hide a cell in the column to hide column 1
e.Row.Cells[1].Visible = false;
}