title: Catching keypress in ASP.NET textbox
body: <p>Is there an easy wayt o capture a keypress (in my case: F5) in a ASP.NET textbox, and executing a server method as a response? </p>
  
  <p>I've created a simple SQL frontend, and out of habit (from SQL Server Mgmt Studio), I keep pressing F5 when I'm done typing my query, but that always refreshes the browser, instead of executing my SQL query :-)</p>
  
  <p>Can I do this in ASP.NET using possibly some Javascript or jQuery ?</p>
  
  <p>Marc</p>
  
  <p>UPDATE:</p>
  
  <p>I have this jQuery code on my ASP.NET page:</p>
  
  <pre><code> $(document).ready(function() {
      $("#&lt;%= txtQuery.ClientID %&gt;").keydown( function (e) {
          if (e.keycode == 116) {
             $("#&lt;%= btnExecute.ClientID %&gt;").trigger('click');
          }
      });
   });
  </code></pre>
  
  <p>I tried various combinations of "e.which", "e.keycode" and various values for keycode - but none seem to work. I'm using MS IE 7 on my dev machine. <code>txtQuery</code> is the ASP.NET textbox where I type my query, and <code>btnExecute</code> is the ASP.NET button which will send that query to SQL Server to be executed.</p>
  
  <p>Any ideas?  Do I need to suppress the standard event handling somehow? And if so: then how do I accomplish that?</p>