Solved

VB.Net and JQuery Provoking

Posted on 2011-09-23
3
270 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

861 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

24 Experts available now in Live!

Get 1:1 Help Now