title: How to trigger a jQuery function from code-behind?
body: <p>I am trying to call a jQuery function from ASP.NET code behind.</p>
  
  <p>I don't want it to be triggered by the jQuery click event; I want to trigger the jQuery function--->"show the dialog" in the code behind of my control.  </p>
  
  <pre><code>$(document).ready(function () {
      $("#LinkButton1").click(function(){
          $("#hightlight_show1").toggle();
      });
  
      var dialog1 = $("#Add").dialog({
              autoOpen: false,
              width: 620,
              height: 400
      });
  
      // Move the dialog back into the &lt;form&gt; element 
      dialog1.parent().appendTo(jQuery("form:first"));
  
      $("#BT_add").click(function () {
         $("#Add").dialog("open");
         return false;
  });
  </code></pre>
  
  <p>I have tried something like this but it did not work:</p>
  
  <pre><code>$(document).ready(function () {
      $("#LinkButton1").click(function () {
          $("#hightlight_show1").toggle();
      });
  
      var dialog1 = $("#Add").dialog({
          autoOpen: false,
          width: 620,
          height: 400
      });
  
      // Move the dialog back into the &lt;form&gt; element 
      dialog1.parent().appendTo(jQuery("form:first"));
  
      function a() {
          $("#Add").dialog("open");
          return false;
      };
  
  });
  </code></pre>
  
  <p>I specify this in the code behind using <code>Page.ClientScript.RegisterStartupScript()</code>:</p>
  
  <pre><code>Page.ClientScript.RegisterStartupScript(
      this.GetType(),
      "a",
      "a();",
      true
   );
  </code></pre>