title: Javascript block won't run after update panel postback, more complicated
body: <p>I'm working on usercontrol called 'TimePicker',</p>
  
  <p>This usercontrol utilizes the jquery timepicker, and wraps it to make it simple to use in asp.net.</p>
  
  <p>I'm binding the jquery timepicker to a textbox using a simple script:</p>
  
  <pre><code>$('#&lt;%= timepicker_textbox.ClientID %&gt;').timepicker({
      onClose: function() {
          __doPostBack('&lt;%= timepicker_textbox.ClientID %&gt;', '');
      }        
  });
  </code></pre>
  
  <p>I also chose to put this textbox inside an update panel, in order to avoid full page refresh after that the user chose a time and caused a postback.</p>
  
  <p>The problem is that after that updatepanel reloaded, any script in the page is not running again, and therefore the jquery timepicker is not applied to the textbox.</p>
  
  <p>I managed to fix this by adding the following code:</p>
  
  <pre><code>Sys.Application.add_load(function () {
      Sys.WebForms.PageRequestManager.getInstance().add_endRequest(&lt;%= timepicker_textbox.ClientID %&gt;_onControlLoad());
  });
  
  
  function &lt;%= timepicker_textbox.ClientID %&gt;_onControlLoad()
  {
      $('#&lt;%= timepicker_textbox.ClientID %&gt;').timepicker({
          onClose: function() {
              __doPostBack('&lt;%= timepicker_textbox.ClientID %&gt;', '');
          }        
       });
  }
  </code></pre>
  
  <p>This causes the function to be registered and then run again on each partial postback.</p>
  
  <p>The problem is that this fixed the problem only for this specific timepicker, 
  and not for any other elements in the same page!</p>
  
  <p>This is major issue to me, since I'm having more than one timepicker inside a page, 
  And when choosing time on one timepicker, the others aren't working...</p>
  
  <p>Any suggestions are welcome.</p>
  
  <p>Thanks,</p>
  
  <p>Eitan.</p>