title: Page.ClientScript.RegisterStartupScript Not Working
body: <p>I already code the Javascripts at site-master page. However, when I call Javascirpts, it does not work. Anyone can help me figure it out? Thank you</p>
  
  <p>Here is the Javascript I code in the site-master page.</p>
  
  <pre><code>&lt;head id="Head1" runat="server"&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;link href="~/Styles/Site.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link rel="stylesheet" href="/Styles/jquery-ui-1.9.2.custom.min.css" /&gt;
  &lt;script type="text/javascript" src="/Scripts/jquery-1.8.3.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/Scripts/jquery-ui-1.9.2.custom.min.js"&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
      function dialog(text) {
          $("#text").text(text);
          $("#dialog-message").dialog
          ({
              buttons: {
                  close: function () { $(this).dialog("close"); }
              }
          });
      };
  
      function dialogWithRedirect(text, url) {
          $("#text").text(text);
          $("#dialog-message").dialog
      ({
          buttons: {
              close: function () { location.href = url; $(this).dialog("close"); }
          }
      });
      };
  
      var confirmed = false;
      function confirmDialog(obj, text) {
          if (!confirmed) {
              $("#text").text(text);
              $("#dialog-message").dialog({
  
                  buttons: {
                      "Confirm": function () {
                          $(this).dialog("close");
                          confirmed = true;
                          obj.click();
                      },
                      "Cancel": function () {
                          $(this).dialog("close");
                      }
                  }
              });
          }
          return confirmed;
      };
  &lt;/script&gt;
  
  &lt;asp:ContentPlaceHolder ID="HeadContent" runat="server"&gt;
  &lt;/asp:ContentPlaceHolder&gt;
  </code></pre>
  
  <p></p>
  
  <p>And this is how I call Javascripts.</p>
  
  <pre><code>protected void ImageButtonOK_Click(object sender, ImageClickEventArgs e)
      {
          if (tbFirstName.Text != "" &amp;&amp; tbLastName.Text != "" &amp;&amp; tbNickName.Text != "" &amp;&amp; tbUsername.Text != "" &amp;&amp; tbPassword.Text != "" &amp;&amp; tbConfirmPassword.Text != "")
          {
              if (validateUsername())
              {
  
                  Database database = new Database();
                  string sql = "INSERT INTO users " +
                               "           (user_id " +
                               "           ,first_name " +
                               "           ,last_name " +
                               "           ,nickname " +
                               "           ,image " +
                               "           ,username " +
                               "           ,password) " +
                               "     VALUES " +
                               "           (" + user_id + " " +
                               "           ,'" + tbFirstName.Text + "' " +
                               "           ,'" + tbLastName.Text + "' " +
                               "           ,'" + tbNickName.Text + "' " +
                               "           ,'" + pictureFile + "' " +
                               "           ,'" + tbUsername.Text + "' " +
                               "           ,'" + tbPassword.Text + "')";
                  database.executeNonQuery(sql);
                  database.close();
  
                  Page.ClientScript.RegisterStartupScript(typeof(Page), "print", "&lt;script type='text/javascript'&gt; dialogWithRedirect('Save complete','user.aspx');&lt;/script&gt;");
  
              }
  
          }
          else
          {
              Page.ClientScript.RegisterStartupScript(typeof(Page), "print", "&lt;script type='text/javascript'&gt; dialog('Please fill all required data');&lt;/script&gt;");
  
          }
      }
  </code></pre>