title: Object #<Object> has no method 'dialog'
body: <p>I'm trying to work through a problem I'm having with jQuery's dialog box in an ASP.Net application.</p>
  
  <p>I have a page that has two dialog boxes, <code>tos_text</code> and <code>tos_thankyou</code> which are of course simple <code>&lt;div&gt;</code> tags with the content to display.</p>
  
  <p>First, I'm using the Google CDN to reference jQuery:</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>The problem I'm having is that when I attempt to attach the jQuery dialog method, the browser claims that the dialog method does not exist on the object.  Since I'm using ASP.Net, I'm injecting the javascript conditionally at runtime in the <code>Page_PreRender</code> event handler as such:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    protected void Page_PreRender(object sender, EventArgs e)
      {
          ScriptManager.RegisterStartupScript(this, GetType(), "RegisterThankYouDialog",
              "\n&lt;script type='text/javascript'&gt;$(function() { $('#tos_thankyou').dialog({ autoOpen: false, modal: true, buttons: { Ok : function() { $(this).dialog('close'); } } }); });&lt;/script&gt;\n", false);
  
          ScriptManager.RegisterStartupScript(this, GetType(), "RegisterTOSDialog",
              "\n&lt;script type='text/javascript'&gt;$(function() { $('#tos_text').dialog({ autoOpen: false, modal: true, }); });&lt;/script&gt;\n", false);
  
          if (Show || ForceShow)
          {
              ScriptManager.RegisterStartupScript(this, GetType(), "ShowTOSDialog",
                  "\n&lt;script type='text/javascript'&gt;$(function() { $('#tos_text').dialog('open'); });&lt;/script&gt;\n", false);
          }
  
          if (ShowThankYou)
          {
              ScriptManager.RegisterStartupScript(this, GetType(), "ShowThankYou",
                  "\n&lt;script type='text/javascript'&gt;$(function() { $('#tos_thankyou').dialog('open'); });&lt;/script&gt;\n", false);
          }
      }
  </code></pre>
  
  <p>This is the rendered code (from the Chrome JS console, with error included):</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  //&lt;![CDATA[
  (function() {var fn = function() {$get("ctl00_smScripts_HiddenField").value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();//]]&gt;
  &lt;/script&gt;
  &lt;script type='text/javascript'&gt;new Sys.WebForms.Menu({ element: 'ctl00_NavigationMenu', disappearAfter: 500, orientation: 'horizontal', tabIndex: 0, disabled: false });&lt;/script&gt;
  &lt;script type='text/javascript'&gt;$(function() { $('#tos_thankyou').dialog({ autoOpen: false, modal: true, buttons: { Ok : function() { $(this).dialog('close'); } } }); });&lt;/script&gt;
  default.aspx:610Uncaught TypeError: Object [object Object] has no method 'dialog'
  
  &lt;script type='text/javascript'&gt;$(function() { $('#tos_text').dialog({ autoOpen: false, modal: true, }); });&lt;/script&gt;
  
  &lt;script type='text/javascript'&gt;$(function() { $('#tos_text').dialog('open'); });&lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  //&lt;![CDATA[
  Sys.Application.add_init(function() {
      $create(Sys.Extended.UI.ModalPopupBehavior, {"BackgroundCssClass":"modalBackground","CancelControlID":"ctl00_MainContent_btnPrivacyOK","PopupControlID":"ctl00_MainContent_pnlPrivacy","dynamicServicePath":"/default.aspx","id":"ctl00_MainContent_ModalPopupExtender1"}, null, null, $get("ctl00_MainContent_btnPrivacy"));
  });
  //]]&gt;
  &lt;/script&gt;
  </code></pre>