Mike Ormond's Blog

Musings on mobile development and Windows Phone 7 in particular.

ASP.NET 4.0 AJAX Enhancements

ASP.NET 4.0 AJAX Enhancements

  • Comments 1

Another in my unpredictable series on ASP.NET 4.0, let’s take a look at one of the biggest areas of investment, AJAX. You can break this down into 3 key areas:

  • Refactoring of the ASP.NET AJAX libraries
  • The ability to declaratively instantiate client-side behaviors and controls
  • Data support (templating, data binding, observer pattern and much more)

To date, the ASP.NET AJAX library has been pretty much a monolithic block (well, 3 blocks in fact – MicrosoftAjax.js, MicrosoftAjaxWebForms.js, MicrosoftAjaxTimer.js). But as we continue to extend and enrich the AJAX library, it makes sense to refactor it into more manageable chunks and allow developers to reference (and thus have the user download) only those features required for the page.

As a result, the ASP.NET AJAX library in ASP.NET 4.0 has been refactored into around a dozen separate files. Via the <ScriptManager /> you can opt to explicitly reference only those parts of the library you need. And of course, you can combine these server-side into a single request using the script combining capability introduced in ASP.NET 3.5 SP1.

If you’ve done any work with ASP.NET AJAX client-side behaviors or controls, you’ll be familiar with the need to write some Javascript in order to create instances of your component and perhaps associate it with a specific element on the page. In ASP.NET 4.0 you can do this declaratively in a nice clean fashion and most importantly, a fully standards-compliant fashion.

Declarative instantiation of components is nice, but in the same way that LINQ was the catalyst for .NET  language features such as lambdas, anonymous types and implicit typing, it’s really just a pre-requisite for the biggie – those data features…

ASP.NET 4.0 allows you to define client-side templates, including markup, expressions and conditional code, that support complex data binding to objects, collections and even services. As well as the DataView control (which supports binding to objects, arrays and services), there is a DataContext class which supports change tracking and specialised classes for ADO.NET Data Services. Oh, and there’s also an implementation of the observer pattern for Javascript objects and arrays.

I should also mention that we’ll ship jQuery in the box with VS2010 so whether you’re after a comprehensive AJAX framework or powerful yet lightweight DOM manipulation, ASP.NET 4.0 has exactly what you need.

All the above merit exploring in more depth – I'll do that over the next few days in follow-up posts.

Technorati Tags: ,
  • Hi Mike,

    I think it's fascinating how Asp.Net Ajax 4 is shaping up as a competitor to Silverlight 3/4 along the lines of DataBinding, RIA Service, validation framework, controls etc; this is going to be a significant choice for MS developers perhaps on a project by project basis.

    I think Silverlight will still win on performance and features, but it's getting tighter;  Ajax big win over Silverlight is of course "Reach" - though I wonder how long it will be before Silverlight closes in on that?  2 Years?

    Am I right in saying Office 2010 Web has both a Silveright and Ajax version?  If so then that would be an interesting comparison from both the users and development perspective...

    Cheers

    Ian

Page 1 of 1 (1 items)