advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
CoDe Magazine
Resources
Ajax Is Not Evil
Productivity Tip
Partners & Affiliates
advertisement
advertisement
advertisement
CoDe Magazine
Subscribe to CoDe Magazine
Average Rating: 4.5/5 | Rate this item | 2 users have rated this item.
Email this articleEmail this article
 
Using the Ajax.NET Framework
What developer wants to spend hours manually writing Ajax plumbing when the Ajax.NET framework does this for free? 

advertisement
he Ajax.NET Framework presents a remarkably easy-to-use framework that will simplify Ajax development and allow developers to spend more time on implementation details and less time on parsing XML.

If Ajax is still a new concept for you, Ajax stands for Asynchronous JavaScript and XML. The "XML" part of Ajax my be a little misleading as some methods use other technologies in place of XML for data transfer between the browser and the server. The Ajax.NET Framework uses JSON (JavaScript Object Notation).

Ajax groups these technologies and provides a break from the traditional model requiring a post back to the server in order to run server-side methods. Ajax allows a browser to make calls to server-side code and receive a response from the server all without using the ASP.NET postback, which transfers full ViewState and page information with each request.

How Does Ajax Work?
The "magic" of Ajax lies in the use of the HttpRequest object to facilitate communication between the browser and the server. This object will contact the server, call the designated code and wait for a response from the server. The nice part about this system is that since the processing is asynchronous, the Web browser will continue to allow the user to keep working uninterrupted with the Web application while waiting for the server to process requests.

A very simplistic way to think about this technology is to say that in one respect Ajax grants the user the ability to call code-behind methods from JavaScript.

Callbacks
Ajax will request a service from the server and wait for a response. The way Ajax applications wait for the response is what makes the applications useful. Once you have sent the request to the server for processing, the browser will continue to do its work. Once the server generates a response the browser will recognize that response and then continue processing.

Even with a few extra server calls you are still sending less data across the wire than you would with traditional postbacks which often include full ViewState information.
You have two options available to you when calling code on the server in an Ajax environment. You may choose to define a callback method or you may choose to simply send a message to the server and allow the application to continue with its work without being notified the operation is complete.

If you choose to recognize the response, you will define a callback method in JavaScript. A callback method runs once the browser has recognized a response from the server. Once the callback method is invoked, the application may now conduct some additional processing of the response data as provided by the server.

Implications of N-Tiered Development
Some of the traditional lines of n-tier application architecture may blur when you use Ajax. In an application where you use Ajax but you haven't thought through the architecture, you might have a considerable amount of overlap of business logic in the user interface layer.

You want to make sure you keep your architect's hat on while developing Ajax applications. Remember that the business layer should know nothing of how to display information to the user and the user interface should not contain business rules. To accomplish this goal, you should strictly return data to the user interface layer and allow UI services to format the data for the final presentation. An Ajax developer may need to use an interim layer between the business objects and the browser to further prepare server-side data before rendering to the browser.

What Is the Ajax.NET Framework?
The Ajax.NET Framework lies on top of the .NET Framework and abstracts the plumbing for Ajax interaction between the server and browser. What is the difference between Ajax and the Ajax.NET Framework? Ajax.NET is a framework around the technologies that create the Ajax method. Without such a framework you must manually code the client/server communication, which is both error-prone and time consuming.

The Ajax.NET Framework dynamically creates proxy objects that act as the communication mechanism between the browser and server. When a developer creates a method in code behind, that method may be decorated with an attribute to tell the Ajax.NET engine to create the necessary JavaScript proxy.

The JavaScript proxy object will have a similar interface to the object as it exists on the server. Using the Ajax.NET Framework, client-side objects will have the same properties as the server-side counterpart. Object methods, however, will not translate from the server side to the proxy object. The proxy is simply a data transfer object and cannot implement server-side logic.

  Next Page: A Basic Example
Page 1: IntroductionPage 4: Create the Application Configuration Class
Page 2: A Basic ExamplePage 5: Update the TaskCollection Class
Page 3: The Task SystemPage 6: Add Element Methods
© Copyright Component Developer Magazine and EPS Software Corp., 2006
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: BitLocker Encryption on Windows Server 2008
Go Parallel Article: Intel Thread Checker, Meet 20 Million LOC
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES