Tips: Using the Ajax.NET Professional library
The
Ajax.NET Professional library written by
Michael Schwarz provides a rich and easy to use wrapper around the technologies that make up Ajax. Here are a few tips to get the most out of the library:
- Limit the number of Ajax request as much as possible. If you have to render a bunch of UI, it is better to call a single method vs. calling numerous methods that do the same work.
- Don't use Ajax to retrieve large amounts of data.. Be conscience of response time and network latency. Although the user is spared a postback that doesn't mean they should have to wait a long time for something to be processed. If that is the case then a postback might actually be the better solution. In general, you should really only need to be passing back the data needed to update the UI.
- Don't attempt to use the Ajax.NET library with the Cassini (default) web server in ASP.NET 2.0. I'm not sure why it is, but the Ajax.NET library and the Cassini web server just don't work well together. Simple actions like calling a server-side method, do not always work. It could be a conflict with the ports, regardless, the Cassini web server and Ajax.NET library are not a reliable solution. Instead, use the Ajax.NET library with IIS.
- Take advantage of Generics if you are using the 2.0 Framework. Generics can save you a lot of code on the server side and will be returned to the client in the form of an array.