title: Get Id from GridView using Button
body: <p>I have a Grid Where I have Id like this:</p>
  
  <pre><code>&lt;div class="row "&gt;
              &lt;asp:GridView ID="gvIndex" CssClass="table table-bordered table-responsive"  runat="server" AllowPaging="True" PageSize="10" AutoGenerateColumns="False" AutoGenerateEditButton="False" OnRowCommand="gvIndex_RowCommand"&gt;
  
                  &lt;Columns&gt;
                      &lt;asp:BoundField DataField="Id" HeaderText="Número" HtmlEncode="false"&gt; //This is my Id Field
                          &lt;FooterStyle Width="200px" /&gt;
                      &lt;/asp:BoundField&gt;
                      &lt;asp:BoundField DataField="Nombre" HeaderText="Nombre" HtmlEncode="false"&gt;
                          &lt;FooterStyle Width="400px" /&gt;
                      &lt;/asp:BoundField&gt;
                      &lt;asp:BoundField DataField="Direccion" HeaderText="Dirección" HtmlEncode="false"&gt;
                          &lt;FooterStyle Width="400px" /&gt;
                      &lt;/asp:BoundField&gt;
                      &lt;asp:BoundField DataField="Puesto" HeaderText="Puesto" HtmlEncode="false"&gt;
                          &lt;FooterStyle Width="400px" /&gt;
                      &lt;/asp:BoundField&gt;
                      &lt;asp:BoundField DataField="Fecha" HeaderText="Fecha" HtmlEncode="false"&gt;
                          &lt;FooterStyle Width="175px" /&gt;
                      &lt;/asp:BoundField&gt;
                      &lt;asp:BoundField DataField="CorreoElectronico" HeaderText="Correro Electrónico" HtmlEncode="false"&gt;
                          &lt;FooterStyle Width="350px" /&gt;
                      &lt;/asp:BoundField&gt;
  
                      &lt;asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Edición"&gt;
                          &lt;ItemTemplate&gt;
  
                              &lt;asp:LinkButton ID="EditarIngreso" OnClick="EditarIngreso_Click" CommandArgument="&lt;% Eval('Id') %&gt;" CommandName="SelectRow"  CssClass="btn btn-primary" runat="server"&gt;Editar&lt;/asp:LinkButton&gt; //There I want to get value of Id
                              &lt;%--&lt;asp:HyperLink ID="EditarIngreso" BorderStyle="None" OnClick="EditarIngreso_Click" Text="Editar"  runat="server"&gt;HyperLink&lt;/asp:HyperLink&gt;--%&gt;
                              &lt;%--&lt;a id="EditarIngreso" runat="server" style="text-decoration: underline; border: none"&gt;Editar&lt;/a&gt;--%&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                  &lt;/Columns&gt;
  
              &lt;/asp:GridView&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>As you can see, I want to get value of Id in this line:</p>
  
  <pre><code> &lt;asp:LinkButton ID="EditarIngreso" OnClick="EditarIngreso_Click" CommandArgument="&lt;% Eval('Id') %&gt;" CommandName="SelectRow"  CssClass="btn btn-primary" runat="server"&gt;Editar&lt;/asp:LinkButton&gt; 
  </code></pre>
  
  <p>But I don't know what is wrong with this, I try to get it with this method:</p>
  
  <pre><code>protected void gvIndex_RowCommand(object sender, GridViewCommandEventArgs e)
          {
              MyID.Value = e.CommandArgument.ToString();
          }
  </code></pre>
  
  <p>But I just receiving <code>"&lt;%Eval('Id') %&gt;"</code> instead my Id into <code>MyID.Value</code></p>
  
  <p>Any Help is very appreciate. Regards</p>