Hello,
My colleague was using the ScriptManager's AsyncPostBackError event to change an exception message and once this event finished, a JavaScript alert message box was displayed alerting the user. Now, with either the new AJAX 3.5, or .NET 3.5, or Visual Studio 2008, or any combination of the 3, the JavaScript alert does not show up. Instead, Internet Explorer indicates to the user a JavaScript error has occurred and no message box is shown.
I have read many posts by members stating that the JavaScript alert box shows up and they would like to disable it but I on the other hand would like the message to pop-up. I tried using ScriptManager.RegisterStartupScript to throw an alert box up at the end of the event but that does not seem to do anything at all.
If I use the following in the body of my HTML..
<
script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
function EndRequest(sender, args)
{
if (args.get_error())
{
alert(args.get_error().description);
args.set_errorHandled(true);
}
}
</script>
This works except my custom error message is displayed along with the Exception type to the left which I cannot remove.
Example: Sys.WebForms.PageRequestManagerServerErrorException: Please select whether this address is residential or commercial.
I'd like the alert to just say, 'Please select whether this address is residential or commercial'
Does anyone have any idea how I can make this work?
Suggestions and comments are greatly appreciated.
-- Rick