title: Specify HeaderText for an AutoGenerateColumn GridView
body: <p>I have a gridview that is generating columns automatically (having a <code>List&lt;&gt;</code> DataSource), now what I need is to specify <code>HeaderText</code> for it's columns. I've googled a lot and checked some previous questions only to find that <em>autogenerated grids doesn't have Columns Collection</em>, at last I created a custom grid of my own  following this article <a href="http://damieng.com/blog/2006/09/25/extending-gridview-to-access-generated-columns" rel="nofollow">http://damieng.com/blog/2006/09/25/extending-gridview-to-access-generated-columns</a>
  now I am getting the column collection in a property <code>BoundColumns</code>, I have tried setting HeaderText property on <code>PageLoad</code>, <code>RowDataBound</code> events  but all in vain, I need to know on which event I can put this code to make it  work  </p>
  
  <pre><code>            gridUsers.BoundColumns[0].Visible = false;
              gridUsers.BoundColumns[1].HeaderText = "Login ID";
              gridUsers.BoundColumns[2].HeaderText = "User Name";
              gridUsers.BoundColumns[3].Visible = false;
              gridUsers.BoundColumns[4].HeaderText = "User Email";
              gridUsers.BoundColumns[5].HeaderText = "User Status";
              gridUsers.BoundColumns[6].HeaderText = "User Role";
  </code></pre>
  
  <p>P.S: Visible properties are working on Page Load.   Any Help is appreciated.</p>