YOUR FEEDBACK
John Portnov wrote: This code does not work for me. I created a new website and a C# console applic...
AJAXWorld RIA Conference
$300 Savings Expire August 22
Register Today and SAVE!

SYS-CON.TV

2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
TOP THREE LINKS YOU MUST CLICK ON


A Primer on Microsoft Atlas
AJAX-ifying your applications

Ever since the advent of the Internet, Web applications have lagged behind desktop applications in terms of interactivity and responsiveness. One of the biggest drawbacks in the conventional Web model has been the cycle of inactivity between the user request and the server response. Reducing this period of inactivity has been the point of focus for any developer who wants to improve the responsiveness of Web applications and raise the user experience to levels offered by desktop applications.

AJAX (Asynchronous JavaScript and XML) is one of the approaches that help Web developers improve the responsiveness and interactivity of Web applications. As the name suggests, it works by having asynchronous communication between the browser and the server thereby doing away with the need to re-create the entire page, and reducing the response time that translates into better interactivity. However implementing AJAX may not be easy since it involves writing a lot of code in a client-side scripting language like JavaScript and any developer who has worked with one would attest to the fact that developing and debugging complicated client scripts can sometimes be daunting. It can be even more daunting to maintain Web applications where the logic is interspersed between client and server code.

The Atlas framework from Microsoft promises to fill this gap and make it easier for the ASP.NET developer to easily develop interactive AJAX-enabled applications. In this article we'll look at what ATLAS is and focus on the server controls that an ASP.NET developer can use to "AJAX-ify" his applications.

What Is Microsoft Atlas?
Atlas is Microsoft's flavor of AJAX. It offers a comprehensive platform that marries client-scripting functionality with ASP.NET server-side features. Atlas promises to provide the AJAX capabilities minus the complexity associated with developing AJAX applications Atlas offers two sets of components, one for client-side functionality and another that offers server-side functionality.

On the client side, Atlas offers the following:

  • A consistent set of APIs that adds object-oriented features to JavaScript such as Namespaces and type system which are very similar to the .NET Framework and let .NET developers easily develop in JavaScript
  • Built-in browser compatibility. The libraries handle browser compatibility and there is no need to write browser-specific versions.
  • An XML-based declarative syntax that lets developers do client-side scripting and easily attach Atlas behaviors to existing HTML elements.
On the server side, Atlas provides a set of server controls that complements the client-side functionality. The controls are like any regular ASP.NET control, integrate well into Visual Studio, and let the developer extend existing ASP.NET controls with Atlas behavior.

Atlas also lets the developer integrate ASP.NET services like Profiles, membership roles, and personalization from the client-side script. All these translate into much better productivity for the ASP.NET developer.

Atlas Server Controls
Event though Atlas client-side bits expose a wide variety of functionality, I feel that it's the serve- side functionality and controls that endear it to the ASP.NET developer as they automatically emit all the client script needed for the AJAX functionality. For an ASP.NET developer used to doing server-side development these controls are a natural choice since they eliminate the need to master the new XML-based side-scripting model and write client-side scripts. They offer the easiest way to build rich user experiences because these controls are based on a programming model that's already familiar to the ASP.NET developer.

Another major advantage of using server controls is that the core application logic would still be on the server side. This means that a developer can go back and easily add Atlas/AJAX functionality to an existing ASP.NET 2.0 application. Out of the different Atlas server controls, two of them stand out, the Script Manager and Update Panel controls.

Script Manager
This control is single-handedly the most important Atlas server control and as the name suggests manages the different script pieces needed on an Atlas-enabled page. Every page that uses Atlas server controls should have one instance of the Script Manager. First and foremost what the ScriptManager does is to register the core script file needed for Atlas functionality.

<atlas:ScriptManager runat="server" ID="smgr1"
    EnableScriptComponents="True" EnablePartialRendering="True">
<ErrorTemplate>
      <span id="errorMessageLabel" runat="server"></span>
      <input id="okButton" type="button" value="OK" runat="server" />
    </ErrorTemplate>
   <Scripts>
    <atlas:ScriptReference ScriptName="AtlasUIMap" />
    <atlas:ScriptReference Path="~/MyScripts/MyScript.js" />
   </Scripts>
   <Services>
    <atlas:ServiceReference Path="ComplexService.asmx" />
   </Services>
</atlas:ScriptManager>

The code snippet above shows the markup of a ScriptManager. As you can see, the ScriptManager control exposes a set of attributes and elements that lets us define its functionality. Let's take a closer look at them.

1.  EnablePartialRendering - Setting this to true controls how the page is rendered and lets specific parts of the page content be updated instead of the whole page during post backs. In fact for most AJAX functionality to work, it has to be set to true.

2.  EnableScriptComponents - This attribute defines how the ScriptManager references scripts. If set to true, the ScriptManager automatically references other Atlas scripts that help provide UI behaviors. Some UI behavior scripts are AtlasUIDragDrop and AtlasUIglitz. However if set to false, it only downloads the scripts that are needed for Atlas's core functionality.

3.  ScriptReference - Instead of relying on automatic script registration, it's also possible to selectively reference and register scripts by using a collection of ScriptReferences. The ScriptReference object exposes three attributes, namely the ScriptName, Path, and Browser. ScriptName defines the name of the script being referenced. ScriptName can either be one of the pre-set Atlas script names like AtlasUIDragDrop or AtlasUIGlitz or it can be a custom script that the developer wants to register. If the ScriptName is set to one of the pre-set Atlas script names, it's automatically referenced. To reference a custom script the ScriptName is set to "custom" and the path of the script file has to be specified. The Browser attribute is used to specify the browser where the script will be downloaded.

4.  ServiceReference - ServiceReference is similar to ScriptReference, but it's used to register Web Services that may be used in the page. ServiceReference exposes three attributes: the Path that defines the path of the service, the GenerateProxy that decides if a proxy is generated for the referenced service, and the Type attribute used to reference the Web Service by type name.


About Jeevan Murkoth
Jeevan Murkoth is a Microsoft Certified Solutions Developer (MCSD) in .NET (Early Achiever) and a Microsoft Certified Application Developer (MCAD) in .NET. He currently consults for Tennessee Valley Authority and lives in Chattanooga, TN. He has an MS in Management Information Systems from Texas Tech University.

LATEST AJAXWORLD RIA STORIES
The computing forecast, quips WaveMaker CEO Chris Keene, calls for continuing heavy clouds. But what are the technical issues for building AJAX applications in the cloud? What is the most productive way to build AJAX applications for deployment to EC2? These and allied enterprise...
Genuitec announced the availability of MyEclipse Enterprise Workbench 7.0 milestone 1. This milestone release delivers advanced AJAX tooling for Java EE and full Application Lifecycle Management (ALM) capabilities for Eclipse 3.4 Ganymede, among other enhancements.
Genuitec announced the availability of the first milestone release of MyEclipse 7.0 Blue Edition. This release provides WebSphere developers with advanced AJAX tooling, enhanced reporting technologies and Eclipse 3.4 support, among other enhancements.
WaveMaker announced the release of WaveMaker Visual AJAX Studio 4.0. WaveMaker Studio is an open source development tool that makes it easy to build visually stunning web applications. With just 15 mouse clicks and zero coding, a developer can build and deploy a sleek, web-based ...
AJAX has dominated the web space so extensively that it needs no introduction. Connecting to a server via XMLHttpRequest and making a partial page refresh is what makes this technique so attractive. However, use of these AJAX requests, although very attractive, can pose dangers a...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE