There was definately a change between the default behavior in the ASP.NET AJAX Extensions 1.0 and ASP.NET AJAX 3.5. This can been seen by looking at the default endPostBack event handlers for the Sys.WebForms.PageRequestManager. The former version displays the error using an Alert while the later just rethrows the error.
// ASP.NET AJAX Extensions 1.0
function Sys$WebForms$PageRequestManager$_endPostBack(error, response) {
this._processingRequest = false;
this._request = null;
this._additionalInput = null;
var handler = this._get_eventHandlerList().getHandler("endRequest");
var errorHandled = false;
if (handler) {
var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, this._dataItems, response);
handler(this, eventArgs);
errorHandled = eventArgs.get_errorHandled();
}
this._dataItems = null;
if (error && !errorHandled) {
alert(error.message);
}
}
// ASP.NET 3.5
function Sys$WebForms$PageRequestManager$_endPostBack(error, executor, data) {
if (this._request === executor.get_webRequest()) {
this._processingRequest = false;
this._additionalInput = null;
this._request = null;
}
var handler = this._get_eventHandlerList().getHandler("endRequest");
var errorHandled = false;
if (handler) {
var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
handler(this, eventArgs);
errorHandled = eventArgs.get_errorHandled();
}
if (error && !errorHandled) {
throw error;
}
}
If you want the Alert to appear in your ASP.NET AJAX 3.5 code, you just need to make some small changes.
First, you need to add an handler for the ScriptManager's AsyncPostBackError event and then set the AsyncPostBackErrorMessage.
protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message;
}
Then you need to add a handler for the client-side PageRequestManager's endRequest event. In there, you can get the AsyncPostBackErrorMessage set on the server-side and use an Alert to display the message to the user.
function pageLoad()
{
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onEndRequest);
}
function onEndRequest(sender, args)
{
var msg = args.get_error().message;
alert(msg);
args.set_errorHandled(true);
}
I hope this helps.