Archive for August 2006

Is this COOL or what?

This is a test post to check Windows Live Writer. You can get more information here.

Thursday, August 17, 2006
Posted by Adnan Farooq Hashmi

Atlas at last! - Part III

Previously:
Atlas at last Part II: Looking to the road ahead
Atlas at last Part I: Getting down and dirty with JavaScript

Matt Gibbs has written an excellent "Atlas at last" article in the July 2006 issue of MSDN Magazine. Check it out: Atlas At Last: ASP.NET Atlas Powers the AJAX-Style Sites You’ve Been Waiting For.

So much can change between 2 posts is hard to imagine. For one, WinFX was renamed; now its called .NET 3.0 (combining WPF, WCF, WF, WCS). I touched upon the idea of WPF in the web browser in the previous Atlas at last post. An article on MSDN titled "Deploying Microsoft .NET Framework Version 3.0" explains how to detect if .NET 3.0 is installed on a PC from within JavaScript/JScript code running inside a browser. Get ready; we would be seeing sites developed using .NET 3.0, with WPF on the presentation tier, very soon. The keyword to remember is "Smart Client"; browser-based applications lending a rich presentation to a SOA (Service-Oriented Architecture) strategy.

There's more than one way to skin a cat, or so I heard, and that really depends on what you want to do after you've done it. In the same way, you have a choice to develop with Microsoft "Atlas" using 2 different approaches, depending on the type of project you are building, the development time you have, and/or the amount of responsiveness and richness you want in your web app. The 2 approaches are: Server-Centric and Client-Centric Development. The diagram below provides a glimpse of what these 2 approaches encompass.



Very briefly, the Server-Centric approach primarily involves using Atlas Server Controls to achieve the desired result. This essentially means adding the "UpdatePanel" control, and enclosing all other server controls within it. Control Extenders, as the name implies, allow developes to add DHTML behaviors to existing server or client controls. Although the current online literature on Atlas does not classify the use of Control Extenders as a server-centric approach, it is easy to explain Control Extenders to developers in context of the server-centric approach, mainly because they encapsulate DHTML behaviors, shielding the user from the complexity of the JavaScript code, and are used pretty much like pre-developed ASP.NET server controls.

The Client-Centric approach relies on client-side script (no surprises there) running inside the web browser to not only achieve most of the things possible with the server-centric approach, but to also create and add rich client-side interactivity within the webpage. Remember, these 2 approaches are not alternatives to each other. A single website, or even a single webpage, can have implementations of both approaches. The next 2 "Atlas at last" posts would look into more detail of both these approaches separately.

It is incorrect to assume that only the client-centric approach involves scripting. There are no clear guidelines in existence that would mandate the use of one approach instead of the other. Many web/ASP.NET developers who are just getting started with Microsoft "Atlas" would want to go with the UpdatePanel control since it requires the least effort and development time. However, the UpdatePanel might not hold the answer to what you wanted to achieve in the first place. I received a couple of queries from people who wanted to know which approach they should follow for their projects, and my answer was always the same: it depends. Its better to choose the approach for each webpage accordingly instead of making a choice of the approach to follow at the beginning of the project and adhereing to it throughout. Let me elaborate through some scenarios.


  • The webpage comprises of static information.
    Recommended approach: None; Since the data contained in the page does not change, it is pointless to use Atlas in it.

  • The webpage is used to present dynamic information stored on the server in a database/XML file, and loads inside a particular region of the page depending on the query string value.
    Recommended approach: Server-Centric; The UpdatePanel would only change a portion of the page after a response is received from the server, while static portions of the page like header images, logos, menus etc. would not reload.

  • The webpage lists information from a database table, and the user should not have to navigate to a different webform page to enter new, or modify existing data from that table.
    Recommended approach: Control Extenders; The 'Modal Popup Control Extender' provides an easy-to-implement mechanism to dislay a webform in a modal popup window, graying-out the rest of the portion of the screen outside the popup window, allowing the user to enter new, or change existing, information; When the modal popup closes, the portion of the page that lists the data from the table refreshes to show the updated information from the server (without a full postback).

  • The webpage consists of multiple dropdown lists (combo-boxes), and each one after the first dropdown list populates with values based on the value selected in a previous dropdown, like a City dropdown populating everytime for the Country seleted from another dropdown list.
    Recommended approach: Control Extenders; The 'Cascading DropDown Control Extender' allows a dropdown list to call and web service in response to a selection made into it and populate the next dropdown list in the sequence.

  • You want to give the user the ability to either enter a new value into a textbox or else select from a list of values already stored in the database.
    Recommended approach: Both Client-Centric and Server-Centric approaches support the Auto-Complete behavior (Also see next point).

  • You want to give the user the ability to either enter a new value into a textbox or else select from a list of values already stored in the database, based on a selection or preference specified ealier.
    Recommended approach: Client-Centric; Only JavaScript would allow the Auto-complete list to be populated based on a condition, since XML-Script and the AutoComplete Control Extender only attach a web service (hard-code) to an autocomplete list, whereas JavaScript code provides the flexibility to select from a list of web services depending on a condition.



The above does not (and cannot possibly) cover all the scenarios that Microsoft "Atlas" is designed for. Stick around for more "Atlas at last" posts.
Tuesday, August 08, 2006
Posted by Adnan Farooq Hashmi
My Passion, My Inspiration, My Pakistan

Popular Posts