Ajax.NET Professional Library

Ajax.NET Professional LibraryEvery once in a while, a technology is extremely simplified with the introduction of new wrapper libraries. These libraries use existing technologies but make the development process easier to use by wrapping the sometimes difficult concepts into easier-to-use, more simplified concepts. So, the term wrapper library comes from having a library of code wrapped around existing technology. You can tell when a great wrapper library is released because of its instant popularity. This chapter covers one such wrapper library known as the Ajax library for .NET. In this chapter and the next, we will show off the simplicity of talking back and forth between client browsers and your application server without page postbacks. We’ll also dig a little under the hood of the library to show you how and why the library works.


Preparing Your Application to Use Ajax.NET Pro
1. To use the Ajax.NET Pro library, your first step is to set a reference to the library. This allows you to use library functionality inside your application. Create a new web site in Visual Studio. Visual Studio 2005 automatically creates a Bin folder for you. Right-click on this folder and select Add Reference. Figure 7-1 shows the Add Reference dialog box. Select the Browse tab, and navigate to the AjaxPro.dll file that you downloaded (or compiled from the Library Source Code). Once this is selected, click the OK button, and you will have successfully referenced the Ajax.NET Pro library from your application.
2. The Ajax.NET Pro library uses a page handler to process requests that come into the server from your client application. This page handler needs to be wired up to your application, and this is done by an inserting it into your Web.Config file. This code should be inserted in the section of Web.Config:

You have completed Step 1 in using the Ajax.NET Pro library in your application. However, the real magic in this example is in Step 2-making that code accessible using JavaScript so that you can access this functionality in the client browser. This is very simple to do using the Ajax.NET Pro library, and that is just where you’re going with this example. One of the nicest features of the Ajax.NET Pro library is that you can easily adapt your existing code without rewriting it. Yes, you read that correctly-you do not have to rewrite any of your code to make it available in your JavaScript. All you have to do is register your code with the Ajax.NET Pro library. That sounds kind of strange-register your code-doesn’t it? The first two of the three steps in using the Ajax.NET library are the easiest to implement. And if your code is already written, this next step should take you only about 2 minutes. To make your code accessible using JavaScript, you first register your page class with the Ajax.NET Pro library. This class has method(s) on it that you want to expose to JavaScript. Then, you register the method you want to expose. This is all explained in the next two sections.

Website: media.techtarget.com | Filesize: 291kb
No of Page(s): 22
Click here to download Ajax.NET Professional Library.

Related Tutorial

Tags: , , , ,

Comments

Leave a Reply