How to execute JavaScript on UserControl PostBack in asp.net?
<p>We have an asp.net page that consists of multiple user controls, many of which have the <code>visible</code> attribute set to <code>false</code>.
By selecting a radio button, one of the user controls is shown by setting the <code>visible</code> attribute to <code>true</code> in the code-behind. When this happens, we want a JavaScript function to be run. The script has been registered using <code>ScriptManager.RegisterStartUpScript</code> in the <code>Page_Load</code> method of the page.</p>

<p>How can we make this work?</p>

<p>Things we've tried:</p>

<ul>
<li>Register script in the user control (both code-behind and markup)</li>
<li>Trying some of the other methods available on the <code>ScriptManager</code></li>
<li>Using jQuery <code>$(document).ready()</code></li>
</ul>

<p>But in all cases the script is only executed when the page is loaded/reloaded.
The only <em>hack</em> that seems to work, is calling the function inside the <code>pageLoad()</code> function as this function gets called after every PostBack.</p>
