title: How to change the Header Text of Gridview after Databound?
body: <p>I have a gridview I bound a DataTable with that Gridview Its dynamic so no hardcode Text in desin.</p>
  
  <p>I tried to change it after Databound and in PreRender of gridview but no Success.</p>
  
  <p>Actually there are Underscores('_') in text and I want to Replace it with space.</p>
  
  <p>Below is code</p>
  
  <pre><code>&lt;asp:GridView ID="grdSearchResult" runat="server" AutoGenerateColumns="True" Width="99%" OnPreRender="grdSearchResult_PreRender"
              OnRowCreated="grdSearchResult_OnRowCreated" OnPageIndexChanging="grdSearchResult_PageIndexChanging"&gt;
              &lt;HeaderStyle ForeColor="White" BackColor="#215B8D" /&gt;
              &lt;AlternatingRowStyle BackColor="#F7F7F7" /&gt;
              &lt;RowStyle CssClass="gridtext" HorizontalAlign="Center" /&gt;
          &lt;/asp:GridView&gt;
  
  
  
  protected void grdSearchResult_PreRender(object sender, EventArgs e)
  {
      for (int i = 0; i &lt; grdSearchResult.Columns.Count; i++)
      {
          grdSearchResult.Columns[i].HeaderText = grdSearchResult.Columns[i].HeaderText.Replace("_", "");
      }
  }
  </code></pre>