title: simulate user clicking udate button in a gridview with javascript
body: <p>I have a custom web control *.ascx file. I am trying to simulate the user clicking the update button in a gridview using a java script. I have this script at the top of my .ascx page :</p>
  
  <pre><code> &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"&gt;
  
          $(document).keypress(function (e) {
              if (e.which == 13) {
                  document.getElementById("LinkButton1").click();
              }
          });
  
      &lt;/script&gt;
  </code></pre>
  
  <p>The "LinkButton1" is located in this template field: </p>
  
  <pre><code>  &lt;asp:TemplateField ShowHeader="False"&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:LinkButton ID="LinkButton1" runat="server" onKeyPress="" UseSubmitBehavior="True" CausesValidation="True" 
                                CommandName="Update" TabIndex="13" Text="Update"  &gt;&lt;/asp:LinkButton&gt;
                            &amp;nbsp;&lt;asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                CommandName="Cancel" Text="Cancel"&gt;&lt;/asp:LinkButton&gt;
                        &lt;/EditItemTemplate&gt;
                        &lt;ItemTemplate&gt;
  </code></pre>
  
  <p>What am I missing or doing wrong? </p>