Fredrik Normén's Blog - NSQUARED²
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

Microsoft Most Valuable Professional
     .Net Framework - ASP.Net - Architecture - Development
NOTE: This list of posts will only list the 15 latest posts, to see the rest, select from the Archives located in the menu to the left. The RSS will only list the 10 lastest posts.
Hide a GridView column at runtime

Category:  ASP.Net 2.0

I thought I wrote a post about how to hide a GridView column at runtime but didn’t. So I thought you maybe will be interested in a simple example.

 

To hide a column at runt time you can hook up to the GridView’s RowDataBound event and set the Visible property of the cell you want to hide to false:

 

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

e.Row.Cells[0].Visible = false;

}

Posted: Wednesday, October 19, 2005 - 18:06 GMT+1    Print     E-mail    Comments (14)
   fredrik.nsquared2.com - 2007