02 May 2010

ASP.NET Ajax

What is ASP.NT AJAX?
Let me try to put it in simple words what i understood.
ASP.NET Ajax is a set of extensions to asp.net to implement AJAX functionality. AJAX stands for Asynchronous JavaScript and XML, which, very simply put, is a way of transferring data between the server and client without the sending the entire page, and thereby creating a complete post back. This allows for a richer experience for the user, since loading dynamic content can be done in the background, without refreshing and redrawing the entire page.
Well, if you are not aware of what is Ajax surly you might be unknowingly experienced what it is. If you have ever used Gmail or Outlook Web Access, you have used an Ajax enabled web application, and especially Google have made Ajax very popular.
Now let me try to give a fare idea on what is Ajax Control Tool kit?
The Ajax Control Toolkit contains a rich set of controls that you can use to build highly responsive and interactive Ajax-enabled Web applications. The Ajax Control Toolkit contains more than 40 controls, including the AutoComplete, CollapsiblePanel, ColorPicker, MaskedEdit, Calendar, Accordion, and Watermark controls. Using the Ajax Control Toolkit, you can build Ajax-enabled ASP.NET Web Forms applications by dragging-and-dropping Toolkit controls from the Visual Studio Toolbox onto a Web Forms page.


Well, here I am not daring to explain you complete AJAX technology provided by Microsoft rather love to explain where I have used it and what is the technical problem which made me to go behind Ajax with a simple example. Sounds good right?
Problem definition:
I was developing a module which has a complex UI with 4 grid view controls across 2 tab controls! And among that one grid has dropdown box, in change of value we need to do some server side coding. So here what happen each time when user change the values of these dropdown user experience a flicker due to post back.
The Solution :The solution was very simple wit Ajax tool kit.
In the CodeBehind, there's the value change event captured. OnSelectedIndexChanged.
In the markup part, we use two new things, when compared to regular ASP.NET: The ScriptManager control and the UpdatePanel control. The ScriptManager makes sure that the required ASP.NET AJAX files are included and that AJAX support is added, and has to be included on every page where you wish to use AJAX functionality. After the manager, we have one of the most used controls when working with AJAX, the UpdatePanel. This control allows you to wrap markup which you would like to allow to be partially updated, that is, updated without causing a real postback to the server.

The UpdatePanel control is probably the most important control in the ASP.NET AJAX package. It will AJAX'ify controls contained within it, allowing partial rendering of the area.
The tag has two childtags - the ContentTemplate and the Triggers tags. The ContentTemplate tag is required, since it holds the content of the panel. The content can be anything that you would normally put on your page, from literal text to web controls.
This is something very minimal to explain the AJAX technology. I would suggest please go in to deep in to this technology, and I promise you will be getting interesting things that we can go ahead and implement in our web applications.

No comments: