title: CommandArgument in the Gridview
body: <p>I have a gridview like this. </p>
  
  <pre><code>&lt;asp:GridView ID="grdMerchant" runat="server" GridLines="None"
     HeaderStyle-Font-Bold="True" AutoGenerateColumns="False" AllowSorting="True" ShowHeader="false" OnRowDataBound="grdMerchant_RowDataBound" OnRowCommand="grdMerchant_RowCommand" DataKeyNames="OrderID" style="table-layout:auto;width:100%;" &gt;  
  
  
  &lt;asp:TemplateField &gt;
  &lt;ItemTemplate&gt;
     &lt;asp:Linkbutton ID= "btnView" runat="server" Text="View" OnClick="btnView_OnClick" CommandArgument='&lt;%#Eval("OrderID")%&gt;' &gt;&lt;/asp:Linkbutton&gt;
  </code></pre>
  
  <p>
   </p>
  
  <p>How do i have to get the OrderID of the selected row. I tried using  </p>
  
  <pre><code>int OrderID = (int)grdMerchant.DataKeys[row.RowIndex][2];
  </code></pre>
  
  <p>But it gets null and i know this is not the way. Help me. </p>
  
  <p>Thank you in advance!</p>