Monday, November 8, 2010

What is ASP.NET Ajax?


Ajax enables you to build highly interactive and responsive web applications by doing more in the browser.

The ASP.NET Ajax Library

The ASP.NET Ajax Library is an open-source JavaScript library that can be used with both ASP.NET Web Forms and ASP.NET MVC applications.
1.The ASP.NET Ajax Library includes the very popular, open-source, jQuery library. jQuery enables you to easily retrieve and manipulate elements from a HTML document by using a selector syntax similar to the syntax used in Cascading Style Sheets.
2.The ASP.NET Ajax Library includes the Ajax Control Toolkit. The Ajax Library contains more than 30 controls that enable you to easily create rich, interactive web pages. For example, you can use the Ajax Library controls to display HTML editors, auto-complete textboxes, cascading dropdown lists, picture slide shows, and modal popup dialog boxes.
3.The ASP.NET Ajax Library includes a powerful client data access library. By taking advantage of ASP.NET Ajax client templates and client data-binding, you can build a database-driven web application that executes entirely within the web browser.

Ajax in ASP.NET Web Forms

The ASP.NET Ajax Library enables you to enhance ASP.NET Web Forms applications with Ajax. You don't need to know JavaScript to use the controls in the ASP.NET Ajax Library. For example, if you want to add a popup calendar to a TextBox control, you can simply select the Add Extender task option and select the Toolkit Calendar from a dialog box.

If, on the other hand, you are comfortable working directly with JavaScript then you can instantiate ASP.NET Ajax Library controls by using jQuery. For example, the following line of code creates and attaches an Ajax calendar control to an input element with the ID startDate:

$(“#startDate”).calendar();

UpdatePanel Control

ASP.NET Web Forms also includes the UpdatePanel control which enables you to create a better user experience by performing partial page updates. The UpdatePanel hijacks a normal post operation and performs an asynchronous post operation instead. To learn more about the UpdatePanel control, watch the video How Do I Implement Dynamic Partial-Page Updates.

Ajax in ASP.NET MVC

The ASP.NET Ajax Library enables you to enhance ASP.NET MVC applications with Ajax. Many ASP.NET MVC developers are already passionate about jQuery. The ASP.NET Ajax Library extends jQuery with a rich set of over 30 client controls (the Ajax Control Toolkit), a client script loader, and a powerful client data access library. For example, you can create an Ajax watermark control in an MVC view like this:

$(“#firstName”).watermark(“Enter some text…”);

The ASP.NET Ajax Library includes a powerful client data access library that you can use to interact with MVC controller actions. For example, you can use the ASP.NET Ajax Library to retrieve a set of database records from an MVC controller action that returns a JSON result. By taking advantage of Ajax client templates, you can render the database records directly within the browser:

Ajax Helper Methods

Additionally, the ASP.NET MVC framework includes built-in helper methods that enable you to perform asynchronous form posts and partial page updates without writing any JavaScript. For example, theAjax.ActionLink() helper enables you to update a region of a view when you click a link.

Microsoft Ajax Content Delivery Network

The Microsoft Ajax content delivery network (CDN) enables you to easily add ASP.NET Ajax Library and jQuery scripts to your Web applications. You can start using the ASP.NET Ajax Library or jQuery simply by adding a <script> tag to your page that points to Ajax.microsoft.com.

By taking advantage of the Microsoft Ajax CDN, you can significantly improve the performance of your Ajax applications. The contents of the Microsoft Ajax CDN are cached on servers located around the world. In addition, the Microsoft Ajax CDN enables browsers to reuse cached JavaScript files for Web sites that are located in different domains. View instructions for using the Microsoft Ajax CDN.

0 comments:

Post a Comment