title: How to call function in ScriptManager.RegisterClientScriptBlock
body: <p>I am trying to call a jQuery function on postback (C#) using scriptmanager. </p>
  
  <p>When I type the function in the ScriptManager.RegisterClientScriptBlock it works but if I call the function, it doesn't. </p>
  
  <p>Here is my code.</p>
  
  <p><strong>This code works</strong>: </p>
  
  <pre><code>&lt;script runat="server" type="text/javascript"&gt;
  protected void Button1_Click(object sender, EventArgs e) {
  ScriptManager.RegisterClientScriptBlock(UpdatePanel1, UpdatePanel1.GetType(), "MyFun1", "$(document).ready(function () {$('#header2a').fadeIn(5000); });", true);
   }
   &lt;/script&gt;
  </code></pre>
  
  <p><strong>This doesn't work:</strong></p>
  
  <pre><code>&lt;script runat="server" type="text/javascript"&gt;
  protected void Button1_Click(object sender, EventArgs e) {
     ScriptManager.RegisterClientScriptBlock(UpdatePanel1, UpdatePanel1.GetType(), "MyFun1",   "myFunction();", true);
   }
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function () {
  function myFunction() {    
  $('#header2a').fadeIn(5000);
  }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Could anyone please point me what I am doing wrong?</p>