Link to home
Start Free TrialLog in
Avatar of pauledwardian
pauledwardian

asked on

Simple jQuerry Question

Can someone PLEASE tell me how to call this function from C#:

I tried doing this:

protected void myButton(object sender, EventArgs e)
{
    .....
    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>MsgBox();</script>", false);
}

Open in new window


<html xmlns="http://www.w3.org/1999/xhtml">
  <meta charset="utf-8" />
  <title>jQuery UI Dialog - Animation</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
  <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
      function MsgBox() {
          // increase the default animation speed to exaggerate the effect
          $.fx.speeds._default = 1000;
          $(function () {
              $("#dialog").dialog({
                  autoOpen: false,
                  show: "blind",
                  hide: "explode"
              });

              $("#opener").click(function () {
                  $("#dialog").dialog("open");
                  return false;
              });
          });
      }
  </script>

</head>
<body>
 
<div id="dialog" title="Basic dialog">
  <p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
 
<button id="opener">Open Dialog</button>
 
 
</body>
</html>

Open in new window

Avatar of sivagnanam chandrakanth
sivagnanam chandrakanth
Flag of India image

Try this

 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "MsgBox();", true);
Avatar of leakim971
try this :

    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "window.onload = function() { MsgBox(); }", true);
Avatar of pauledwardian
pauledwardian

ASKER

No luck with any one of them.
This is what I do:
  ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "MsgBox();", true);

Open in new window


 <meta charset="utf-8" />
  <title>jQuery UI Dialog - Animation</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
  <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
      function MsgBox() {
          // increase the default animation speed to exaggerate the effect
          $.fx.speeds._default = 1000;
          $(function () {
              $("#dialog").dialog({
                  autoOpen: false,
                  show: "blind",
                  hide: "explode"
              });

              $("#opener").click(function () {
                  $("#dialog").dialog("open");
                  return false;
              });
          });
      }
  </script>

Open in new window


<div id="dialog" title="Basic dialog">
  <p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Albert Van Halen
Albert Van Halen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks