Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple jQuerry Question

Posted on 2013-01-09
6
Medium Priority
?
296 Views
Last Modified: 2013-01-25
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

0
Comment
Question by:pauledwardian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 12

Expert Comment

by:sivagnanam chandrakanth
ID: 38761765
Try this

 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "MsgBox();", true);
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38761771
try this :

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

Author Comment

by:pauledwardian
ID: 38761797
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

0
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 1500 total points
ID: 38762396
Just remove your function wrapper.
<script type="text/javascript">
	// 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

0
 

Author Closing Comment

by:pauledwardian
ID: 38820360
thanks
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question