Three Patterns of Constructing an ASP.NET AJAX-based Applications - Choosing the Pattern Most Suitable for You
(Page 2 of 4 )
With the short analysis above, we can divide all the scenarios based on the MS AJAX framework into three typical patterns, as generalized below.
1. Rebuilding a legacy ASP.NET 2.0 application.
Obviously, there exist tons of legacy ASP.NET 2.0 applications around us; this even includes older applications reconstructed for ASP.NET 2.0. Some of them hold features that can benefit from being enhanced with AJAX, such as adding an automatically populating function to some TextBox controls, locally updating areas that often change, and so forth. Since the MS AJAX client-side solution is pretty distinct from that of the ASP.NET 2.0 server side and we are unwilling to rewrite the current entire project with full functions, we have to rebuild them using the MS AJAX server-side solution. Luckily, this kind of pattern requires only a little effort, without even a line of code. By merely adding an ASP.NET 2.0 server-side Extender control you can "ajaxify" your legacy projects elegantly. We won't dwell much on this because later on we'll examine a lengthy sample introducing this solution.
2. Creating a "sheer'"AJAX application from scratch.
"Sheer" AJAX applications refer to those for which there is no presentation tier logic performed on the server side except for the data, while all the presentation logic is accomplished through the client-side JavaScript programming. A typical example is one of Microsoft's latest products -- Windows Live Mail, all of whose functions (including users input, communication with the server side, user interface alteration, etc.) are performed on the client side. Undoubtedly, this contrasts sharply with our familiar ASP.NET development pattern; however, it will result in outstanding server-side performance and clearer application architecture. In such scenarios, we should, as a top priority, take into consideration this kind of solution.
3. Constructing web applications running on non-ASP.NET 2.0 server-side platforms.
When you plan to develop web applications that run on non-ASP.NET 2.0 server-side platforms, we have to consider the MS AJAX client-side solution. A typical example is the PHP case as mentioned above.
Well, for now, I guess you may have already singled out your favorite routine for your ASP.NET AJAX journey. However, you should notice that the two modes (server-centric vs. client-centric) mentioned above are not absolutely opposite but supplement each other. This means that in a real development scenario we just lay emphasis on one side, such as in the case of the "sheer" MS AJAX pattern; we still need the server-side control-ScriptManager to send the necessary JavaScript files that the MS AJAX client side requires.
So much for the discussion of theory. Let's roll up our sleeves to create a vivid sample. Here, we will exemplify the first kind of solution by ajaxifying the famous Microsoft Job Site Starter Kit.
Ajaxifying the Microsoft Job Site Starter Kit
As one of the famous Microsoft Starter Kit samples, the Job Site Starter Kit ("JSSK" for short) provides a platform for candidates seeking a job and employers seeking an employee to share their needs. Why did we select this starter kit as an example? The reason lies mainly in two aspects. On the one hand, the starter kit demonstrates many new and typical features of ASP.NET 2.0 including themes, master pages, new data controls, membership, roles and profiles. On the other hand, this starter kit lays its emphasis on the implementation of the presentation tier, i.e. utilizing rich controls such as GridView, DetailsView, TreeView, WebPart, and User Controls, which can put the ASP.NET AJAX server-side controls (including ASP.NET AJAX Control Toolkit) to good use. In addition, JSSK holds a comparatively simple logic tier, so that we will concentrate on the controls of the presentation tier.
Author's Note: To help beginners quickly familiarize themselves with JSSK, JSSK provides three initial users with three different types of roles introduced in this sample. They are named "ravi" (with the password "pass$word" and playing the role of employer), "alok" (with the same password and playing the role of job seeker), and "admin" (with the password "admin" and playing the role of administrator) respectively. Here, for brevity, we omit the entire detailed introduction to JSSK, including the download and install process (all pretty easy), while we still cover a bit about JSSK associated with the necessary parts we're going to explore.
Next: Function and Architecture Overview >>
More ASP.NET Articles
More By Xianzhong Zhu