Solved

VB.Net and JQuery Provoking

Posted on 2011-09-23
3
269 Views
Last Modified: 2012-05-12
I want to use JQuery statement. But I want to be able to use ASP.Net button to check for something and if the value detects that an error has occured. I want to then display the JQuery statement.

Here is the code it needs to call. Can I add something on the aspx.vb side to allow me to call the jquery?

Thanks,
Jeff
<script type="text/javascript">

		(function($){

			$(document).ready(function(){
				
				$.jGrowl.defaults.closer = false;

				if ( !$.browser.safari ) {
					$.jGrowl.defaults.animateOpen = {
						width: 'show'
					};
					$.jGrowl.defaults.animateClose = {
						width: 'hide'
					};
				}

				$.jGrowl("An Error has occured.", { sticky: true });
//				$.jGrowl("Another notification.", { sticky: true });
//				$.jGrowl("One last one to make a trifecta.", { sticky: true });
			});
		})(jQuery);

		</script>

Open in new window

0
Comment
Question by:jeffreyjseaman
  • 2
3 Comments
 
LVL 21

Assisted Solution

by:Craig Wagner
Craig Wagner earned 500 total points
ID: 36592424
If I understand correctly, the user clicks your button, a postback occurs, you do some processing in the code-behind of the page (i.e. on the server side), and if some condition is true to want to execute the jQuery that you've listed. Does that sum it up?

If that's the case, you basically need to inject the jQuery into your page when the condition occurs under which you want to execute the jQuery. The page has a property called ClientScript which is a ClientScriptManager object. You should look at using the  RegisterStartupScript method. Here's the documentation page with examples.

http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx
0
 

Accepted Solution

by:
jeffreyjseaman earned 0 total points
ID: 36592580
I got it to work. I set a Session Variable on the Page Load. Then I called that variable from JQuery.

That actually did it for me.

Thanks,
Jeff
0
 

Author Closing Comment

by:jeffreyjseaman
ID: 36813390
User figured it out. Needed to reward someone points for helping.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now