Saturday, July 30th, 2005

Elegant ASP.NET Library for Ajax

Category: .NET

<>p> Fexis Vargas pointed us to Jason Diamond, a DevelopMentor instructor, who has created his own Ajax library for making callbacks to the code behind an ASP page. It started out as an “intellectual exercise”, but he did such a good job, its turning into an open source project, whether he likes it or not :-).

Using his library, developers can write callback methods into the class like this:

public class WebForm1 : Page {
    void Page_Load() {
        Ajax.Manager.Register(this);
    }
	
    [Ajax.Method] double Add(double a, double b) {
        return a + b;
    }
}

and then from the ASP template reference the callback in this manner:

<input id="a" /> + <input id="b" /> = <input id="c" /><br />
<input type="button" value="Add"
    onclick="document.getElementById('c').value = 
    ASP.WebForm1_aspx.Add(document.getElementById('a').value,               
    document.getElementById('b').value);" />

Pretty slick.

Related Content:

  • ASP.NET component library adds Ajax support
    Astron Digital's AspLib component library offers more than 20 components for ASP.NET applications. The library now supports ASP.NET AJAX and offers a...
  • ASP.NET AJAX released
    Microsoft's toolkit for incorporating Ajax functionality into ASP.NET applications has been released. The company is also giving ASP.NET AJAX full...
  • ASP.NET Ajax Tutorial
    This reference introduces developers to Microsoft's ASP.NET Ajax framework with a plethora of tips, tutorials and...
  • Hotskills: ASP.Net Ajax for developers
    ASP.Net Ajax skills, training and salary information details for...
  • Putting ASP.NET AJAX into action
    Alessandro Gallo is a Microsoft MVP in ASP.NET, an active contributor to the ASP.NET AJAX Control Toolkit and one of three authors of "ASP.NET AJAX in...

Posted by Ben Galbraith at 9:43 am
1 Comment

++---
2.7 rating from 11 votes

1 Comment »

Comments feed

j.d.s.
http://www.burzs.com/edit/arg.php?id=14118

Comment by adf — February 13, 2007

Leave a comment

You must be logged in to post a comment.