Blue Theme Orange Theme Green Theme Red Theme
 
Home | Forums | Videos | Photos | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Login Close
User Id:
Password:
 
Forgot Password
Forgot Username
Why Register
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
 Resources  
Close
 Our Network  
Close
Search :       Advanced Search »
Home » AJAX » Getting Started with AJAX 1.0

Getting Started with AJAX 1.0

After fruition of this article, you will have a better understanding of AJAX 1.0 extensions and will learn how to build AJAX enabled Web applications using ASP.NET 2.0 and Visual Studio 2005.

Author Rank:
Total page views :  33981
Total downloads : 
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Become a Sponsor

Recently, Microsoft released the commercial version of AJAX 1.0 as an extension of ASP.NET 2.0. That means you can develop AJAX enabled Web applications using ASP.NET 2.0.

 

After fruition of this article, you will have a better understanding of AJAX 1.0 extensions and learn how easy is to build AJAX enabled Web applications using ASP.NET 2.0 and Visual Studio 2005.

 

What do I need to build AJAX Enabled Applications?

 

You need ASP.NET 2.0 and Visual Studio 2005 to build AJAX enabled Web applications using Visual Studio.

 

Why AJAX?

 

This is probably one of the most asked questions about AJAX.

 

The main advantage of using AJAX enabled ASP.NET Web applications is improved efficiency and reduce the page refresh time. AJAX enables us to refresh only parts of a Web page that have been updated, rather refreshing the entire page.

 

For example, if you have four controls on a Web page say a DropDownList, a TextBox, a ListBox, and a GridView. The GridView control shows some data based on the selection in DropDownList and other controls. Now let's say GridView also has paging and sorting options. So whenever you move to next page or apply sort, the entire page and all four controls on the page will be refreshed and you will notice a page flicker because ASP.NET has to render the entire page on the client side and it happens once

 

In an AJAX-enabled Web page, you will see only the GridView data is being refreshed and rest of the page and controls do not. Doing so, we not only get better performance and faster refresh, we also get a better or should I say "smoother" user experience.

 

You may want to see a live example of AJAX enabled GridView on our www.mindcracker.com web site in Jobs section here: http://www.mindcracker.com/Jobs/. On this page, if you click on Next page link, you will see only GridView data is being refreshed. We are also implementing AJAX on C# Corner and other sites as well.

 

What Browsers AJAX Support?

 

AJAX is JavaScript based and supports most of the browsers including Internet Explorer, Mozilla Firefox, and Apple Safari.

 

How to Install AJAX 1.0?

 

You may download AJAX 1.0 from Microsoft's official AJAX website http://ajax.asp.net. This website also have articles, tutorials and source code samples. We also have an AJAX section on C# Corner here: http://www.c-sharpcorner.com/Articles/ArticleListing.aspx?SectionID=1&SubSectionID=176

 

What is ASP.NET AJAX Extensions?

 

ASP.NET AJAX is a combination of client-script libraries (JavaScript) and ASP.NET server components that are integrated to provide a robust development framework. If you look at your library folder, you will see following .js files listed in Figure 1.

 

Figure 1.

 

What are ASP.NET AJAX Server Controls?

 

The ASP.NET AJAX server controls consist of server and client code that integrate to produce AJAX-like behavior. The following controls are available in AJAX 1.0 library:

 

  1. ScriptManager - Manages script resources for client components, partial-page rendering, localization, globalization, and custom user scripts. The ScriptManager control is required in order to use the UpdatePanel, UpdateProgress, and Timer controls.
  2. UpdatePanel - Enables you to refresh selected parts of the page instead of refreshing the whole page by using a synchronous postback.
  3. UpdateProgress - Provides status information about partial-page updates in UpdatePanel controls.
  4. Timer - Performs postbacks at defined intervals. You can use the Timer control to post the whole page, or use it together with the UpdatePanel control to perform partial-page updates at a defined interval.

 

What is ASP.NET AJAX Control Toolkit?

 

The ASP.NET AJAX Control Toolkit is a collection of samples and components that show you some of the experiences you can create with rich client ASP.NET AJAX controls and extenders. The Control Toolkit provides both samples and a powerful SDK to simplify creating and reusing your custom controls and extenders. You can download the ASP.NET AJAX Control Toolkit from the ASP.NET Ajax Web site.

 

Building your first AJAX enabled ASP.NET Web Application

 

Now let's build a simple AJAX enabled Web application using Visual Studio 2005. In this application, I will load some data from a database in two GridView controls one using AJAX and one without AJAX.

 

After installation of AJAX 1.0, when you create a Web application using Visual Studio 2005, you will see ASP.NET AJAX-Enabled Web Site template in Templates list. See Figure 2.

 

Figure 2. ASP.NET AJAX-Enabled Web Site template

 

When you select this template and create the project, the default page looks like Figure 3 and AJAX Intensions controls are added to the Toolbox. As you can see from Figure 3, the Timer, ScriptManager, ScriptManagerProxy, UpdateProgress, and UpdatePanel controls are available in the Toolbox. The ScriptManager is required to use Timer, UpdateProgress, and UpdatePanel controls.

 

Figure 3. AJAX Extensions Controls

 

Now I add an UpdatePanel, a DropDownList, a ListBox, and two GridView controls to the page. I place on GridView on the UpdatePanel and other outside of the UpdatePanel. By simply placing a control on the UpdatePanel control adds AJAX support to that control. So by placing the GridView control on the UpdatePanel enables AJAX in the Gridview control.

 

I add a SqlDataSource and configure it to get data from a database table and bind it to both of the GridView controls. I also enable sorting and paging in the GridView controls.

 

After that I add some items to the DropDownList and ListBox controls.

 

The final page looks like Figure 4.

 

 

Figure 4.

 

Now when I run the application and click on page number or sort, the AJAX enabled GridView refreshes the data only but the other GridView refreshes the entire page including DropDownList and ListBox controls.

 

Summary

 

Finally, AJAX 1.0 for ASP.NET 2.0 is here. In this article, I talked answered some basic but important AJAX related questions and also showed how to create an AJAX enabled ASP.NET Web application using Visual Studio 2005. 

 


Login to add your contents and source code to this article
 About the author
 
Mahesh Chand
Mahesh is a software developer with over 13 years of experience building systems for Financial and Banking, Engineering & Architectural, Imaging, Construction, Biological & Pharmaceuticals, Healthcare and Education industries. His expertise is Windows Forms, ASP.NET, Silverlight, WPF, WCF, Visual Studio 2010, SQL Server, and Oracle. If you are looking for a Windows Forms, ASP.NET, WPF, Silverlight, C#, VB.NET, Oracle, and SQL Server Consultant in Philadelphia area or remote location, drop me a line at MAHESH [AT] C-SHARPCORNER [DOT] COM.
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Go.NET
Build custom interactive diagrams, network, workflow editors, flowcharts, or software design tools. Includes many predefined kinds of nodes, links, and basic shapes. Supports layers, scrolling, zooming, selection, drag-and-drop, clipboard, in-place editing, tooltips, grids, printing, overview window, palette. 100% implemented in C# as a managed .NET Control. Document/View/Tool architecture with many properties&events. Optional automatic layout.
Dundas Software
Dundas Chart for .NET is the most advanced .NET charting package available today.  With an extremely complete feature set, elegant architecture and easy implementation, Dundas Chart can quickly add advanced Charting functionality to enhance and transform ASP.NET and Windows Forms applications.  Whether you are implementing charting into internal projects, or building applications for clients, Dundas Chart offers advanced technology and advanced results to get the most out of data.
Clickatell's SMS Gateway
Clickatell's Developer Solutions allow you to SMS enable any website or application via a range of API's. Learn More about our API connections.
Free access to .NET Memory Management video
Everything you need to know about Garbage Collection, Temporary Objects, Fragmentation, Finalization and common causes of memory leaks in .NET. Watch the video here.
Microsoft Visual Studio 2010 Professional
Microsoft Visual Studio 2010 Professional will launch on April 12, but you can beat the rush and secure your copy today by pre-ordering at the affordable estimated retail price of $549 (US). Pre-order now.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Developer-Ready ASP.NET 2.0 Web Hosting with 3 MONTHS FREE
Now supporting .NET 3.0 Framework with Windows Workflow Foundation, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), windows CardSpace (WCS)! Providing more flexibility for Developers with Web Services Support and a User/Permission Manger. Also supporting MS SQL 2005/2000 with Real-Time Backups, FREE Automated Attach .MDF Tool, FREE SQL Restore and Shrink SQL DB Tools, and SQL
 
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
 Post a Feedback, Comment, or Question about this article
Subject:  
Comment:  
Become a Sponsor
 Comments
Asp.net with Ajax by Krishna On February 26, 2007
in regular expression validator how to change the validation at run time. please any one help
Reply | Email | Delete | Modify | 
Re: Asp.net with Ajax by Joao On May 29, 2007

I really liked this article. This is my first time using this website. I usually use codeproject and kynou.com. Codeproject has some cool article about ajax-enabled gridview and kynou.com has a walkthough tutorial about ajax-enabled gridview.

Reply | Email | Delete | Modify | 
Nice starter by sunil On March 19, 2007
Thanks mahesh, for posting such a useful article. Could get the first feel of AJAX 1.0
Reply | Email | Delete | Modify | 
Re: Nice starter by Mahesh On April 3, 2007

You are welcome Sunil.

Cheers

Reply | Email | Delete | Modify | 
Re: Re: Nice starter by Mike On April 8, 2007

First Ajax article I read that actually gave me clue as to why I need it.  Thanx Mahesh.

 

-Mike

Reply | Email | Delete | Modify | 
ASP.NET with AJAX by Amit On July 2, 2007
i like this article.i used this site to developed my technology knowladge.so its good artcle for me to batter understading Ajax basics.
Reply | Email | Delete | Modify | 
Good Article for XML beginners... by Saravanan On July 9, 2007
This is useful for XML beginners.
Reply | Email | Delete | Modify | 

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Suggest an Idea  |  Media Kit
Current Version: 5.2009.6.2
 © 2010  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.