What Is Ajax?: Ajax (Asynchronous Javascript and XML) Is A New Paradigm Introduced in 2005. To
What Is Ajax?: Ajax (Asynchronous Javascript and XML) Is A New Paradigm Introduced in 2005. To
Ajax (Asynchronous JavaScript and XML) is a new paradigm introduced in 2005. To use Ajax, able to trade data, with a web server, without having to load a new page. The purpose of Ajax is that of giving the illusion that websites are responsive. It achieves this by processing requests which involve the sending and receiving of small packets of data without refreshing the web browser. Ajax is a technique for creating fast and dynamic web pages. In other words, Ajax allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page. Examples of applications using AJAX: Google Maps, Gmail, Youtube, and Facebook tabs.
History Of Ajax
During browser innovation, Netscape added a feature known as LiveScript (LiveScript became JavaScript and grew more powerful,), allowed people to put small scripts in web pages so that they could continue to do things after youd downloaded them. Ajax came when the Internet Explorer introduced the concept of IFrame element. Microsoft introduced another technique, called as Microsofts Remote Scripting that technique involved the pulling of data through means of Java Applet which communicated with the client side using scripting language like JavaScript. As soon Microsoft introduced new XMLHttpRequest object that acts as an ActiveX control in the Internet Explorer. Finally, in the year 2006, the W3C (World Wide Web Consortium) announced the release of the first draft that included the specification for the object (XMLHttpRequest) and made it an official web standard. AJAX (first coined in the year 2005) is not a new programming language but a relatively new technique for creating faster, better and dynamic web applications. If you have the basic understanding of HTML, XHTML, XML and JavaScript languages then you can have a go with AJAX AJAX is basically based on the following web standard, XML HTML JavaScript CSS.
Server Script, A script is a program or set of instructions that is interpreted or carried out by another program rather than by the processor. A CGI script is an example of a serverside script . Microsoft Ajax Library, There are different library and applications:
1. 2. 3. 4. 5.
Base Class Library Script Code Library Asynchronous Communications, transfer data asynchronously. Browser Capability Browsers (IE, Firefox etc.)
ASP.Net Ajax Extensions, Ajax Extensions provide controls in build with .Net framework.
1. Ajax Server Control 2. Application 3. Asynchronous Communication 1.4.First Program 2.5.1. Open new ASP.NET Web Site then click OK.
3.6. 4.7.2. Open Tool Box and drag ScriptManager and UpdatePanel from AJAX Extensions.
Then drag label and Button, named UsingAjax. Open properties window of UpdatePanel. Go to Triggers property and click on collection then add the controlID (Button name, which you want to make a AJAX part) and select Event (Click). Added one another button outside the UpdatePannel ,named WithoutAjax and a added another Label.
5.8.
6.9. 7.10.
protected void with_ajax_Click1(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString(); } protected void without_ajax_Click(object sender, EventArgs e) { Label2.Text = DateTime.Now.ToString(); }
8.11.
Clicking on "Using Ajax Button" ,only first time (label) will be updated without reloading whole page. Clicking on "Without Ajax Button", whole page Reloaded.
Ajax Controls
You drop the controls to your page (Default.aspx) from the Tab Ajax Extensions.
1. ScriptManager Control
Client script for AJAX-enable ASP.NET Web pages managed by ScriptManager control . ScriptManager control registered the client script for the Microsoft Ajax Library with the page. Script manager support features such as
3. Timer control
The ASP. NET AJAX Timer control
1. Performed Postbacks of pages at defined intervals. 2. Timer control with an UpdatePanel control, enable partial-page updates at a defined 3. 4. 5.
interval. If you want to post the whole page, used Timer Control. The Timer control requires specific settings in a web.config file in order to function correctly. If your application does not contain the required web.config file, errors appear in the Design view of the page where the control would have appeared.
4. UpdatePanel control
Which area on web page you want to partial update, used under the UpdatePanel control. Don't wrap your entire page within an UpdatePanel. You may use several panels on your page. UpdatePanel control is the most important control in the ASP.NET AJAX package. It will AJAX controls contained within it, allowed to partial rendering of the area on the web page.
5. UpdateProgress Control
UpdateProgress control provides status information about partial-page updates in UpdatePanel controls. UpdateProgress control provides, to customize the content. When a partial-page update is very fast, you can specify a delay before the UpdateProgress control is displayed.
ScriptManager Control
Client script for AJAX-enable ASP.NET Web pages managed by ScriptManager control . ScriptManager control registered the client script for the Microsoft Ajax Library with the page. Script manager support features such as
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> </div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </form> </body> </html>
The ASP. NET controls UpdatePanel, UpdateProgress, and Timer needed a ScriptManager control in order to support partial-page rendering. To view the property window, right click to the ScriptManager control and select Properties. Several property opened.
Some Important Properties of SCripManager Controls are: The EnablePartialRendering property is enabled the partial-page rendering. EnablePartialRendering property is true by default. Hence partial-page rendering is enabled when you add a ScriptManager control to the page. The AsyncPostBackErrorMessage, When an unhandled server exception occurs during postback, gets or sets the error message that is sent to the client. At that time AsyncPostBackError Event occur. The AllowCustomErrorsRedirect Property, Custom errors section of the Web.config file is used during an error in an asynchronous postback, gets or sets a value
When a ScriptManager control is already defined in a parent element (or master page or host page already contains a ScriptManager control) then used ScriptManagerProxy control to enables nested components and user control to add service and script. When you use the ScriptManagerProxy control, added to the script and service collections defined by the ScriptManager control. If you do not used specific scripts and services on every page that includes a particular ScriptManager control. Add them to individual pages by using the ScriptManagerProxy control and remove those scripts and services from ScriptManager Control. The ScriptManagerProxy control requires specific settings in a web.config file in order to function correctly.