title: Run a javascript inside control after visibled
body: <p>I have a control that is invisible when page loaded like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function myFunc() {
      // do somthing
  }
  &lt;/script&gt;
  &lt;a runat="server" id="aFileLink" &gt;
  &lt;/a&gt;
  &lt;asp:Image runat="server" ID="imgThumbnail" /&gt;
  </code></pre>
  
  <p>this controle is inside of an update panel. I wanna to run myFunc() function when I set visibility of control to true. so I wrote this line after visibility of control is set to true:</p>
  
  <pre><code>ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "", "myFunc();" , true);
  </code></pre>
  
  <p>However, when control was shown an error is raised and say the method "myFunc" is unknown.
  Why?
  It seems my script block never execute because when I wrote simple "alert" function inside it, it didn't work after control showing!!!! I checked the source of page after showing control and I saw "myFunc" and "alert" functions!</p>