title: How do I make a Textbox Postback on KeyUp?
body: <p>I have a Textbox that changes the content of a dropdown in the OnTextChanged event.  This event seems to fire when the textbox loses focus.  How do I make this happen on the keypress or keyup event?</p>
  
  <p>Here is an example of my code</p>
  
  <pre><code>&lt;asp:TextBox ID="Code" runat="server" AutoPostBack="true" OnTextChanged="Code_TextChanged"&gt;                
  
  &lt;asp:UpdatePanel ID="Update" runat="server"&gt;
      &lt;ContentTemplate&gt;
          &lt;asp:DropDownList runat="server" ID="DateList" /&gt;             
      &lt;/ContentTemplate&gt;
      &lt;Triggers&gt;
          &lt;asp:AsyncPostBackTrigger ControlID="Code" /&gt;
      &lt;/Triggers&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>So in the codebehind, I bind the dropdown on page load.  The Code_TextChanged event just rebinds the dropdown.  I would like this to happen on each keypress rather than when the textbox loses focus.  </p>
  
  <p>I inherited this code recently and this is not the ideal method of doing this for me, but time limitations prevent me from rewriting this in a web servicy method.</p>
  
  <p>I have tried using jQuery to bind the "keyup" event to match the "change" event for the textbox, but this only works on the first key pressed.</p>