Solved

Creating a Message Popup in Visual Web Developer 2005

Posted on 2009-04-01
4
362 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
  • 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

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

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

23 Experts available now in Live!

Get 1:1 Help Now