Home > DeveloperSection > Articles > How do you hide a column for a DataBound GridView

How do you hide a column for a DataBound GridView


ASP.Net ASP.Net 
Ratings:
0 Comment(s)
 4892  View(s)
Rate this:

How do you hide a column 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 myGrid_RowCreated(object sender, GridViewRowEventArgs e)
{

//  hide a cell in the column to hide column 1
  e.Row.Cells[1].Visible = false;
}

 


Don't want to miss updates? Please click the below button!

Follow MindStick