Solved

VB.Net and JQuery Provoking

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with Syntax 9 37
VB.NET 2008 Populate DataModel with DataTable 44 29
vb.net help 4 31
Create a datatable in vb.net dynamically 1 15
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 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