Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem in your code is that <code>prmInstance</code> variable and <code>initializerRegion</code> function declared in global execution context. So the last control overrides <code>initializerRegion</code> function definition. To fix this you may wrap all your code in self called function like below:</p> <pre><code>(function () { var prmInstance = Sys.WebForms.PageRequestManager.getInstance(); prmInstance.add_endRequest(function () { //you need to re-bind your jquery events here initializerRegion(); }); var initializerRegion = function () { $('#&lt;%= autoRegion.ClientID %&gt;').autocomplete({ source: function (request, response) { //...... }, //...... }); $(function () { initializerRegion(); }); })(); </code></pre> <p>This code works well for me:</p> <p>ascx:</p> <pre><code>&lt;script type="text/javascript"&gt; (function () { var prmInstance = Sys.WebForms.PageRequestManager.getInstance(); prmInstance.add_endRequest(function () { initialize(); }); var initialize = function () { $("#&lt;%= TextBox1.ClientID %&gt;").on("keyup", function () { alert(this.value); }); }; $(function () { initialize(); }); })(); &lt;/script&gt; &lt;asp:TextBox runat="server" ID="TextBox1" /&gt; </code></pre> <p>aspx:</p> <pre><code>&lt;asp:ScriptManager runat="server" /&gt; &lt;asp:UpdatePanel runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;uc:WebUserControl2 runat="server" ID="ucWebUserControl2" /&gt; &lt;asp:Button Text="Click Me" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;hr /&gt; &lt;asp:UpdatePanel runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;uc:WebUserControl2 runat="server" ID="WebUserControl1" /&gt; &lt;asp:Button Text="Click Me" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload