You are on page 1of 12

ASP.

NET AJAX

Rakesh Singh
NARESH I TECHNOLOGIES Hyderabad
0

ASP.NET AJAX:
ASP.NET AJAX is a set of technologies to add AJAX (Asynchronous JavaScript and XML) support to ASP.NET. It consists of a client-side script framework, server controls, and more. ASP.NET AJAX is a set of extensions to ASP.NET, developed by Microsoft for implementing Ajax functionality. It is released under the Microsoft Public License (Ms-PL).

Introduction:
=> Microsoft ASP.NET AJAX enables you to quickly create Web pages that include a rich user experience with responsive and familiar user interface (UI) elements. => ASP.NET AJAX provides client-script libraries that incorporate cross-browser JavaScript and dynamic HTML technologies, and it integrates them with the ASP.NET 2.0 server-based development platform onwards. => By using ASP.NET AJAX, we can improve the user experience and the efficiency of our Web applications.

Why Use ASP.NET AJAX?


ASP.NET AJAX enables you to build rich Web applications that have many advantages over traditional Web applications that are completely server-based. ASP.NET AJAX applications offer: Improved efficiency by performing significant parts of a Web page's processing in the browser. Familiar UI elements such as progress indicators, tooltips, and pop-up windows. Partial-page updates that refresh only the parts of the Web page that have changed. Client integration with ASP.NET application services for forms authentication and user profiles. Integration of data from different sources through calls to Web services. A framework that simplifies customization of server controls to include client capabilities. Support for the most popular and generally used browsers, which includes Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari etc... Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

Browser supporting ASP.NET Ajax:


ASP.NET AJAX runs on the following browsers: Microsoft Internet Explorer (>= 6.0) Mozilla Firefox (>= 1.5) Opera (>= 9.0) Apple Safari (>= 2.0) Google Chrome

AJAX Framework
There are many frameworks available to help the developers to quickly construct the Ajax based web applications. We can use Ajax with any server side technologies such as PHP, JSP, Servlets, Perl, ASP, ASP.NET etc. => JQuery is one of the most used Ajax frameworks and it can be used with all the available server-side technologies. These are the following frameworks available for the Windows .NET platform:

Ajax.NET Professional:
Ajax.NET Professional (AjaxPro) is one of the first AJAX frameworks available for Microsoft ASP.NET and is working with .NET 1.1 and 2.0.

Visual WebGui:
Visual WebGui is a new AJAX framework that took a different approach to web application development, specially designed to simplify building highly complex applications like Outlook Web Access (OWA).

ASP.NET AJAX:
ASP.NET AJAX is a set of extensions to ASP.NET developed by Microsoft for implementing Ajax functionality. It is released under the Microsoft Public Licence (Ms-PL). Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

The Major common benefits of incorporating AJAX functionality in a website include: Partial page updates: Only the portion of the page that needs updating is posted back and not the whole page. Faster user response:Since only subsets of data moves between the client and server, the results are shown quickly. Enhanced user interface:With AJAX, desktop like user interface with progress indicators and timers can be implemented. Enhanced features:With AJAX features like auto-complete, auto-suggestions can be implemented.

ASP.NET AJAX Architecture:


ASP.NET AJAX consists of client-script libraries and of server components that are integrated to provide a robust development framework. In addition to ASP.NET AJAX, we can use the ASP.NET AJAX Control Toolkit.

Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

In this above Architecture, it shows the functionality of the client-based Microsoft AJAX Library, which includes support for creating client components, browser compatibility, and networking and core services. It also shows the functionality of server-based ASP.NET AJAX Extensions, which includes script support, Web services, application services, and server controls.

ASP.NET AJAX Server Architecture:


The ASP.NET AJAX server components consist of ASP.NET Web server controls and components to manage the UI and flow of an application, and to manage serialization, validation, control extensibility, and so on.

Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

ASP.NET AJAX Server Controls: The ASP.NET AJAX server controls consist of server and client code that integrate to produce AJAX-like behaviour. These are the following most frequently used ASP.NET AJAX server controls. 1. SrciptManager 2. SrciptManagerProxy 3. UpdatePanel 4. UpdateProgress 5. Timer ASP.NET AJAX Web Services: => ASP.NET AJAX provides Web services that we can use from client script to work with ASP.NET application services for Forms Authentication and User Profiles. => This enables us to use client script to help protect resources by using forms authentication and to persist user-specific settings on the server. In addition to this, ASP.NET AJAX includes network components that make it easy to return results from any Web service call.

ASP.NET AJAX Server Control Extensibility: ASP.NET AJAX enables us to create custom ASP.NET AJAX server controls that include client behaviours. ASP.NET AJAX Client Architecture: The ASP.NET AJAX client-script libraries consist of JavaScript (.js) files that provide features for object-oriented development. The object-oriented features included in the ASP.NET AJAX client-script libraries enable a high level of consistency and modularity in client scripting.

These are the following layers that included in the ASP.NET AJAX script libraries:Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

A Browser Compatibility Layer: This provides compatibility across the most frequently used browsers (including IE, Mozilla Firefox, and Apple Safari etc...) for our ASP.NET AJAX scripts. ASP.NET AJAX Core Services: It include extensions to JavaScript, such as classes, namespaces, event handling, inheritance, data types, and object serialization. An ASP.NET AJAX Base Class Library: It includes components such as string builders and extended error handling. A Networking Layer: It handles communication with Web-based services and applications, and that manages asynchronous remote method calls. Support for JavaScript libraries that are either embedded in an assembly or are provided as standalone JavaScript (.js) files. => Embedding JavaScript libraries in an assembly can make it easier to deploy applications and can solve versioning issues. Support for accessing server-based forms authentication and profile information in client script. Support for release and debug modes and localization support for both assembly-embedded and standalone JavaScript files.

Installing ASP.NET AJAX:


ASP.NET AJAX is built-into ASP.NET 3.5/4/4.5. It is also available as a separate download for ASP.NET 2.0.

With ASP.NET AJAX we can :-> Create next-generation interfaces with reusable AJAX components. Enhance existing pages using powerful AJAX controls with support for all modern browsers. Access remote services and data from the browser without complicated script.

Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

Take advantage of the improved efficiency and ease of use in Visual Studio 2008/2010/2012, with its built-in support for ASP.NET AJAX, improved JavaScript support, and a new Web page designer interface.

=> ASP.NET AJAX enables us to create dynamic Web pages that support partialpage updates. It includes Microsoft ASP.NET 2.0 AJAX Extensions, which is a server framework, and the Microsoft AJAX Library, which consists of client script that runs on the browser. => We can install and use ASP.NET AJAX with Microsoft Visual Studio 2005 or Microsoft Visual Web Developer Express Edition. However, we do not require to install ASP.NET AJAX if we are working on Visual Studio 2008/2010/2012 (ASP.Net 3.5, ASP.Net 4, and ASP.Net 4.5) as its built-in support.

Note: The installation process installs the ASP.NET AJAX assembly (System.Web.Extensions.dll) in the global assembly cache (GAC). Do not include the assembly in the Bin folder of your AJAX-enabled Web site.

System Requirements for Installation: Microsoft ASP.NET AJAX requires the following software. Supported Operating Systems: Windows Server 2003 Windows XP Home Edition Windows XP Professional Windows Vista/Windows 7 Any Windows operating system version (including Windows 2000) that supports the Microsoft .NET Framework version 2.0. Required Software: The .NET Framework 2.0 or later version. Internet Explorer 6 or later

Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

Optional Software: Microsoft Visual Studio 2005 or Visual Web Developer Express Edition Installing Microsoft ASP.NET AJAX: These are the following steps to install ASP.NET AJAX: 1. Make sure that we are logged in with an account that has Administrator rights. (If our account does not have Administrator rights, the installation process displays the error "The system administrator has set policies to prevent this installation.") 2. Uninstall any earlier versions of ASP.NET AJAX. If the installation process finds an earlier version on our computer, it will stop. We can remove earlier versions with the "Add or Remove Programs" application in Control Panel. 3. Download the "ASPAJAXExtSetup.msi" installation package from the ASP.NET AJAX Downloads Web site. 4. To install ASP.NET AJAX just double click on .msi file. We can optionally provide an installation path and a file name for logging. If we do not provide an installation path, the default installation path is used. 5. If we want to add the ASP.NET AJAX Control Toolkit, download and install it from ASP.NET AJAX Control Toolkit Web site. Using ASP.NET AJAX with Visual Studio 2005/2008/2010/2012: If we have Microsoft Visual Studio 2005 installed on our computer, the installation process installs templates for AJAX-enabled Web site projects. When we create a new AJAX-enabled Web site by using Microsoft Visual Studio 2005, the template automatically includes the Web.config file that includes the elements required for ASP.NET AJAX components. If we have Microsoft Visual Studio 2008/2010/2012 on our computer, then we don't need to install ASP.NETAJAXExtSetup.msi becoz it supports built-in. in this case we can create directly "ASP.Net Web Site" or "ASP.Net Empty Web Site" Project from the Templates window. ASP.NET AJAX Extension contains mainly following server controls that are used to create next generation asp.net websites.

Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

These are:

1. ScriptManager 2. ScriptManagerProxy 3. UpdatePanel 4. UpdateProgress 5. Timer 1. ScriptManager:


The ScriptManager control manages client script for Microsoft ASP.NET AJAX pages. By default, the ScriptManager control registers the script for the Microsoft AJAX Library with the page. This enables client script to use the type system extensions and to support features such as partial-page rendering and Webservice calls. The ScriptManager control is required in order to use the UpdatePanel, UpdateProgress, and Timer controls. The ScriptManager control is a non visual component on the page. This control is required on each page that needs to have AJAX features implemented on it. The main functionality of a ScriptManager control is to push Microsoft AJAX framework code to the client side when the page is being rendered. This control can be thought of as the agent who will write the JavaScript required on the client side to facilitate AJAX functionality. There should be only one ScriptManager control on the page that needs AJAX functionality. For Example: <asp:ScriptManager ID="ScriptManager1" runat="server" />

2. ScriptManagerProxy:
ScriptManagerProxy should be used on content pages that have master pages containing a ScriptManager control. It can also be used inside WebUserControls when the page containing the WebUserControl already has the ScriptManager control. Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

For Example: <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"> </asp:ScriptManagerProxy>

3. UpdatePanel:
It enables us to refresh selected parts of the page, instead of refreshing the whole page by using asynchronous postback. This is a container control that contains other ASP.NET controls. This control defines an area that is capable of making partial page updates. We can add various server controls inside an UpdatePanel and these controls inside the UpdatePanel will communicate to the server irrespective of the page's postback. <asp:UpdatePanel ID="UpdatePanel1" runat="server"> </asp:UpdatePanel>

The <asp:UpdatePanel> tag has two child tags: 1. ContentTemplate 2. Triggers The ContentTemplate tag is required, since it holds the content of the panel. The content can be anything that we would normally put on our page, from literal text to web controls. The Triggers tag allows us to define certain triggers which will make the panel update its content.

Working with UpdateProgress Control:


It provides status information about partial-page updates in UpdatePanel controls. UpdateProgress is a control that allows us to display a visual element to the end user to show that a partial-page Postback is occurring to the part of the page making the update. This control is ideal to use when we have long-running AJAX updates. Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.

If a page contains UpdatePanel controls, we can also include UpdateProgress controls to keep users informed about the status of partial-page updates. We can use one UpdateProgress control to represent the progress of partial-page updates for the whole page. Alternatively, we can include an UpdateProgress control for every UpdatePanel control.

Timer Control:
It performs postback at defined intervals. We can use the Timer control to post the whole page, or use it together with the UpdatePanel control to perform partialpage updates at a defined interval. One common task when working with asynchronous Postback from our ASP.NET pages is that we might want these asynchronous Postback to occur at specific intervals in time. In order to achieve this, we use the Timer control available from the AJAX Extensions part of the toolbox. Default interval is 60,000 milliseconds (1 min) and it works under Tick event.

Copyright 2013 https://www.facebook.com/rakeshdotnet All Rights Reserved.