Using the Ajax.NET Framework

What's New?

Featured CoDe Magazine Content

LINQ by Yair Alan Griver

Using the Ajax.NET Framework


The Ajax.NET Framework is a simple-to-use framework that wrapps up most of the plumbing of using Ajax.

There only a few actions you have to take to empower your application with the Ajax.NET framework

  1. Make reference in your project to the Ajax.NET Framework
  2. Add an httpHandler to your web.config
  3. Register your page as an Ajax.NET Framework page
  4. Decorate your methods with the [Ajax.AjaxMethod()]
  5. Call your method in JavaScript using the type name of your page

Here are some examples:

1) Set Reference

No example necessary.

2) HttpHandler

Provide a way for the Ajax.NET Framework to look at each request and determine if it need to do anything.

	<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />

3) Register Page

You register with the type of the page you are registering.


4) Use the Ajax.AjaxMethod Attribute

Here is a sample method.

public TaskCollection GetTasks()
    return WebAppConfig.Tasks;

5) Use the Page Type Name in JavaScript

You call the function in JavaScript using the type name of your page as the object. You may optionally pass in a parameter that will use a call back method when the action is complete.

function GetTasks()

function GetTasks_CallBack(response)

Support Provided by: