Channels ▼
RSS

Tools

AJAX, ASP.NET AJAX, and Partial Rendering



AJAX is not something you can download and install. It's more like a design pattern: It is a model for building Web applications and requires understanding and interpretation. Being a model, AJAX is platform and browser independent. A number of practical suggestions for architects of AJAX solutions have been worked out in the past few years. And they are, again, platform independent and apply to ASP.NET as well as PHP.

But Microsoft provides a fully-fledged AJAX platform on top of ASP.NET and integrates in it a number of common techniques and embraces a number of common suggestions. ASP.NET AJAX is something you can just download and install.

All AJAX books suggest that you create, or anyway get, a JavaScript cross-browser library for updating the DOM and implementing some special effects. In ASP.NET AJAX, you just have this library as a native component of the platform.

AJAX development requires new patterns too as AJAX surely solves a number of problems but also raises quite a few new ones. In ASP.NET AJAX, you don't need to learn about new patterns because the framework allows you to do AJAX on top of the existing ASP.NET application model. This technique is known as "partial rendering".

There's a growing debate in the industry about the role of partial rendering.

To some, partial rendering looks like the old-fashioned way of doing things. They would like to move away from partial rendering mostly because it is not perceived to be cool and trendy.

To others, partial rendering is just right and they would hate to move away from it mostly because they hate doing any JavaScript.

As usual, the truth is somewhere in the middle of these two extremes. Technically speaking, partial rendering plays a clever trick to turn a classic ASP.NET postback into an AJAX asynchronous postback. The request is managed from the page in the traditional way, except that it is delivered to the Web server using an out-of-band channel and bypassing the classic browser pipeline. In doing so, the ASP.NET AJAX framework relies on the browser's XmlHttpRequest object and skips automatic page reloads.

So Is It AJAX or Not?

This is not probably the right way of looking at things. The previous question does have an answer and the answer is no. AJAX is a change of paradigm; with partial rendering you use the same application model of classic ASP.NET.

The right question is, how effective is partial rendering?

It updates portions of the page asynchronously, thus incarnating the primary effect that people expect from AJAX solutions. For the vast majority of applications, partial rendering is just fine. Most applications would benefit from an AJAX-based facelift. As a developer, you can apply partial rendering to a given page in a matter of minutes and without learning curves. It is all about identifying which regions of the page would refresh independently and based on which events.

Partial rendering is a solution that can be applied at the page level. As you can see, it doesn't require a complete re-engineering of the application. Doing full AJAX requires a lot of design upfront. And it's a work that hides a number of pitfalls. Choosing a pure AJAX solution instead of a mix of partial rendering plus some loose scripting is a critical choice that may severely affect your budget. There's no out-of-the-box test to give you advice; the required level of interactivity of the final application is the most significant variable to consider. Partial rendering is more expensive than plain AJAX calls; but not always so expensive to justify a full redesign of the system. This may be really costly. AJAX is a trade-off and there's no prepacked solution to make and keep your users happy.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video