title: How to dynamically populate the ID of a column in a bound ASP.NET GridView
body: <p>I have an ASP.NET GridView as follows...</p>
  
  <pre><code>&lt;asp:GridView ID="grdUserDecisions" runat="server" CssClass="Grid" 
                OnPageIndexChanging="grdUserDecisions_PageIndexChanging" 
                OnSorting="grdUserDecisions_Sorting"&gt;
     &lt;HeaderStyle CssClass="GridHeader"/&gt;
     &lt;AlternatingRowStyle CssClass="GridAltItem"/&gt;
     &lt;RowStyle CssClass="GridItem"/&gt;
     &lt;PagerStyle CssClass="GridPager"/&gt;
     &lt;Columns&gt;
         &lt;%-- I don't want a link --%&gt;
         &lt;asp:HyperLinkField 
              DataNavigateUrlFields="Name" 
              DataNavigateUrlFormatString="/default.aspx?id={0}"
              DataTextField="Name" HeaderText="Name" /&gt;
  
         &lt;%-- I want the id value to be set in the DOM --%&gt;
         &lt;asp:ButtonField ID='&lt;%# Eval("Name") %&gt;' DataField="Name" /&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Is it possible to add a Bound column with an ID value in the DOM that is populated dynamically please?</p>
  
  <p>This line doesn't work, as there is no ID property. Is there a different column type to use?</p>
  
  <pre><code>&lt;asp:ButtonField ID='&lt;%# Eval("Name") %&gt;' DataField="Name" /&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>