Solved

Creating a Message Popup in Visual Web Developer 2005

Posted on 2009-04-01
4
365 Views
Last Modified: 2012-05-06
I have an IF/Then statement  on an aspx.vb page. I need to popup an informational message when certain conditions are met. In searching the web it seem that javascript is what is needed but I can't find a basic example addressing my specific issue.
In other words would someone hold my hand and show me how to do this?

If Count(0) < 2 Then
Popup a message that says "There isn't enough data to create the chart"
0
Comment
Question by:quick503
[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
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Buginator
ID: 24041113
Hello quick503,

I created a code snippet for you, it should work.
Please try it out and let me know.

Regards
If Count(0) < 2 Then
   Dim message As String = "There isn't enough data to create the chart."
   ClientScript.RegisterStartupScript(Me.[GetType](), "alert", [String].Concat("<script>alert('", message, "');</script>"))
End If

Open in new window

0
 

Author Comment

by:quick503
ID: 24041243
No Luck. The If/Then statement works but no message pops up.
0
 
LVL 5

Accepted Solution

by:
Buginator earned 500 total points
ID: 24041437
Sorry, sometimes javascript doesn't like single quotes '.
Here are the fixed version with double quotes:
If Count(0) < 2 Then
   Dim message As String = "There isn't enough data to create the chart."
   ClientScript.RegisterStartupScript(Me.[GetType](), "alert", [String].Concat("<script type='text/javascript'>alert(""", message, """);</script>"))
End If

Open in new window

0
 

Author Comment

by:quick503
ID: 24041566
That works great. Thanks
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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

763 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