title: data Grid Data bound field header text change in c#
body: <p>I have a datagrid that has a BoundColumn there I am trying to change the header text on page load I so fa. I have tried this. </p>
  
  <pre><code>  &lt;asp:datagrid id="dgdata" runat="server" Width="658px" CellPadding="2" PageSize="2" DataKeyField="Name"
                  AutoGenerateColumns="False" ShowFooter="True" BorderColor="AliceBlue" OnItemDataBound="dgTranscript_ItemDataBound"&gt;
            &lt;Columns&gt;
                      &lt;asp:BoundColumn DataField="Name" HeaderText="" ItemStyle-VerticalAlign="Top"&gt;&lt;/asp:BoundColumn&gt;
  &lt;/Columns&gt;
          &lt;/asp:datagrid&gt;
  </code></pre>
  
  <p>C# </p>
  
  <pre><code> dgdata.Columns[1].Visible = true;
              dgdata.Columns[1].HeaderText = lblAverage.Text
  </code></pre>
  
  <p>I want to set the text to be the text that's inside that label but its not letting me if i say without the label it works </p>
  
  <pre><code> dgdata.Columns[1].Visible = true;
              dgdata.Columns[1].HeaderText = "Some Text";
  </code></pre>
  
  <p>Binding Data</p>
  
  <pre><code> DataSet ds;
          DataRow drClient = null;
          dgdata.Columns[1].HeaderText = lblAverage.Text; // Here before the Daatabind I set the text to be that label 
          DataConn.WebExecute(out ds); 
          DataConn.Bind(dgTranscript, ds);// This binds the data to the datagrid
  </code></pre>
  
  <p>It shows that text as the header but when I try punting in any string or a label text it denies the whole header disappears
  Thanks in advance. Best Regards</p>