title: Getting the value from asp:LinkButton's CommandArgument attribute using jquery/javascript
body: <p>I need to get the value of the <code>CommandArgument</code> attribute of a LinkButton, in an asp:Repeater.</p>
  
  <p>I have an asp:Repeater with 2 LinkButtons whose CommandArgument I set to a value:</p>
  
  <pre><code>&lt;ItemTemplate&gt;
      &lt;tr class="odd"&gt;                                        
          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "batch_id")%&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "productId")%&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "serial_number")%&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "activation_card_number")%&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "transaction_amount","{0:C}")%&gt;&lt;/td&gt;                                        
          &lt;td&gt;&lt;%#DataBinder.Eval(Container.DataItem, "response_dt", "{0:M/d/yyyy HH:mm:ss}")%&gt;&lt;/td&gt;                                        
          &lt;td style="text-align:center;"&gt;&lt;%#DataBinder.Eval(Container.DataItem, "resp_process_msg")%&gt;&lt;/td&gt;
          &lt;td style="text-align:center;"&gt;&lt;%#DataBinder.Eval(Container.DataItem, "resp_response_code")%&gt;&lt;/td&gt;
          &lt;td style="text-align:center;"&gt;&lt;asp:LinkButton ID="lnkBtnRestageAdd" CommandName="Add" CommandArgument='&lt;%#Eval("activation_card_number")%&gt;' runat="server" Text="stage" class="add" OnClientClick="return false;" /&gt;&lt;/td&gt;                                                                                
          &lt;td style="text-align:center;"&gt;&lt;asp:LinkButton ID="lnkBtnRestageMinus" CommandName="Subtract" CommandArgument='&lt;%#Eval("activation_card_number")%&gt;' runat="server" Text="stage" class="minus" OnClientClick="return false;" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
  &lt;/ItemTemplate&gt;
  </code></pre>
  
  <p>I have suppressed the PostBack with OnClientClick="return false;" so that I can pop a jQuery dialog modal when the link buttons get clicked:</p>
  
  <pre><code>if (btnAdd != null) {
      $(".add").click(function() {
          $("#&lt;%=divDialogAdd.ClientID %&gt;").removeAttr("style");
          $("#&lt;%=divDialogAdd.ClientID %&gt;").dialog("open");
      });
  }
  </code></pre>
  
  <p>In the modal I have 2 other asp:LinkButtons, and when the 'Yes' button is clicked I do the postback like so:</p>
  
  <pre><code>yesBtn.click(function() {
      setTimeout('__doPostBack(\'btnAdd\',\'\')', 0); //need to add a param
  });
  </code></pre>
  
  <p>What I need to do, is somehow grab the CommandArgument value from the LinkButton in the Repeater, so that I can pass that as a parametere or assign it to a hidden field. I have tried jQuery's <code>attr()</code>, but that only works when the attribute was set using that function as well. How can I get this value, or what other way can I go about this?</p>