title: ASP.NET and jQuery - call from codebehind
body: <p>This is a problem i've tried so solve before but gived up.
  Basicly i'm using ModalPopupExtenders (from AJAX.NET) to display Panels with a few content (text, controls, etc). And i'm calling it from  codebehind. And it works well.</p>
  
  <p>But now i want to replace the ModalPopup with some jQuery dialog box. The problem is calling it from codebehind.
  As far as i know, i have to register the jQuery libraries on RegisterStartup event, but i've tried it and call the jQuery from codebehind but with no sucess.</p>
  
  <p>Can someone help me? I really want to replace the ModalPopup, they gives me to much trouble.</p>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      ScriptManager.RegisterStartupScript(this, GetType(), "registerDialog",
          "$(function() { $('#dialog').dialog({autoOpen:false, show:'blind'}); });", true);
  }
  
  protected void Button1_Click(object sender, EventArgs e)
  {
      ScriptManager.RegisterStartupScript(this, GetType(), "openDialog",
          "$('#dialog').dialog('open');", true);
  }
  </code></pre>
  
  <p>Is this the correct way? I've to register it first to stay hidden. 
  Thanksю</p>