Solved

VB.Net and JQuery Provoking

Posted on 2011-09-23
3
275 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
[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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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