Wednesday, June 29, 2005

AJAX.NET - AJAX in ASP.NET Apps

AJAX.NET is a free AJAX library for ASP.NET. To expose a server-side method present in a code-behind file of a page for asynchronous invocation from the clients all you need to do is mark it with the Ajax.AjaxMethod attribute.

[Ajax.AjaxMethod]
public int Add(int firstNumber, int secondNumber)
{
return firstNumber + secondNumber;
}

The library then generates a Javascript wrapper for that method that uses XmlHttpRequest under the hood to invoke your method at the server, and return the results back to the client.

Have a look!

No comments: