title: Converting an asp:ButtonField to an asp:TemplateField in a GridView Control
body: <p>I currently have a gridview that has an asp:ButtonField as one of the columns. The event handler for the command extracts the row id of the gridview from the command argument and uses that to perform some logic. I now need to switch to using a template field for this column, and want to do something like this:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Action"&gt;
      &lt;ItemStyle HorizontalAlign="Center" /&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:LinkButton CommandName="myaction" CommandArgument="&lt;%#Eval("id")%&gt;" Text="do action" runat="server"/&gt;
          &lt;/ItemTemplate&gt;
   &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>My problem is with the CommandArgument attribute - I don't know how to get it to be the row id from the GridView. Eval("id") doesn't work - does anyone know what the name of the row id property is? Or a better way to do this?</p>