How do you pop up a message (like messagebox.show)?

  • Thread starter Thread starter VB Programmer
  • Start date Start date
V

VB Programmer

I would like my error handler to pop up a message on my webform. How do you
do this?

Currently I'm using System.Web.HttpContext.Current.Response.Write("MY
ERROR")

Any ideas? Thanks!
 
I wanted to pop up a message whenever my general error handling routing was
run. The message would tell the user what the error was. Do I have to
DYNAMICALLY place this alert message on the offending page? If so, can you
post an example of how to do this?
 
There are a couple of ways but this works:

If yourCodeThatChecksForAnError then
response.write("<Script
Language='JavaScript'>alert(yourErrorMessage)</Script>")
End If
 
Another good way is to use the 'RegisterClientScriptBlock' method, and pass
it the '<Script> ... </Script>' string with the javascript you would like
to use.

-Darrin
 
Back
Top