ASP.NET AJAX Reflection

by dee 1. July 2008 09:46

Custom classes that are going to be used in ajax requests to web services' methods should meet the following requirements:

1. Have public default constructor (ASP.NET will not reflect the class on client side if it doesn't meet this condition - NO exception will be thrown)
2. Have setter for each public property (ASP.NET will not set values to the fields which don't have setter - NO exception will be thrown as well)

Tags:

ASP.NET

AJAX and error handling

by dee 7. January 2008 18:34

Use followed code to catch AJAX errors:

 

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args)
{
   if (args.get_error() != undefined && args.get_error().httpStatusCode == '500')
   {
       var errorMessage = args.get_error().message;
       args.set_errorHandled(true);
       alert(errorMessage);
   }
}

Powered by BlogEngine.NET 1.4.0.0
Theme by Mads Kristensen