Blue Theme Orange Theme Green Theme Red Theme
 
Discover the top 5 tips for understanding .NET Interop
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
DevExpress UI Controls
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 :
Page Views : 41111
Downloads : 0
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Nevron Chart
Become a Sponsor
DevExpress Free UI Controls
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

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. 

 

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Mahesh Chand
Mahesh is the founder of C# Corner and Mindcracker Network, an author of several .NET programming books and a Microsoft MVP for 6 consecutive years. In his day to day work, Mahesh is a Senior Software Consultant with over 14 years of IT industry 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 Sharepoint, 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.
Discover the Top 5 .NET Memory Management Fundamentals
To write the best .NET code, you need to know exactly how the .NET framework really manages memory. Ricky Leeks presents the Top 5 fundamental facts of .NET memory management. Learn more.
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.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
DevExpress Free UI Controls
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 | 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 | 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 | Modify 
Re: Nice starter by Mahesh On April 3, 2007

You are welcome Sunil.

Cheers

Reply | Email | 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 | 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 | Modify 
Good Article for XML beginners... by Saravanan On July 9, 2007
This is useful for XML beginners.
Reply | Email | Modify 
Thank You Mahesh by Suresh On November 4, 2010
Thank You for such an easy and explainatory example Mahesh... I hv just started to learn AJAX and this article cleared me the main purpose of using AJAX
Reply | Email | Modify 
Re: Thank You Mahesh by Mahesh On November 7, 2010
I am glad Suresh.

However this is a very old article :)
Reply | Email | Modify 
good by Chichakorn On December 15, 2010
Thank you...
Reply | Email | Modify 
DevExpress Free UI Controls
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.