[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

Creating a Message Popup in Visual Web Developer 2005

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
quick503
Asked:
quick503
  • 2
  • 2
1 Solution
 
BuginatorCommented:
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
 
quick503Author Commented:
No Luck. The If/Then statement works but no message pops up.
0
 
BuginatorCommented:
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
 
quick503Author Commented:
That works great. Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now