Anthem.NET is by far the best AJAX .NET implementation I've seen thus far. I have to hand it to its developer, Jason Diamond, for making this so intuitive and easy to implement these AJAX controls. After reading an article on it on Scott Hanselmans blog last week, I downloaded it and was blown away within the first few minutes of playing with it. Not only does it work for .NET 2.0 but Jason Diamond was kind enough to create an implementation for .NET 1.1, for those of us who have to work on projects in both environments.
Jason has developed it so that the Anthem.NET controls inherit the asp.NET controls functionality while hijacking the OnClick server-side event to utilize client-side events. Within minutes I was able to add AJAX functionality to my current .NET 1.1 project. The only thing that I had to change in my code behind for the server-side events was to set the new UpdateOnCallBack event to true. That's it! Once I compiled and tested it, my application was no longer a site that depended on server-side callbacks for EVERY click event.
Here are the changes needed to add Anthem.NET into your .NET 1.1 applications:
<%@ Register TagPrefix="anthem" Namespace="Anthem" Assembly="Anthem" %>
<anthem:CheckBox ID=”CheckBox1” runat=”server” />
<anthem:CheckBox ID=”CheckBox1” runat=”server” AutoPostBack=”true” />
using Anthem;
using Asp = System.Web.UI.WebControls;
protected Anthem.CheckBox CheckBox1;
protected Asp.CheckBox CheckBox2;
private void CheckBox1_CheckedChanged(object sender, EventArgs e){ DoSomehthing(); CheckBox1.UpdateAfterCallBack = true;}
One thing to note and this is addressed is that Response.Redirect() no longer works since there is no page response for events. Luckily, Jason added a way to work around it. Simply call AddScriptForClientSideEval() with JavaScript to redirect in the Anthem.Manager and it will add this to the client-side page's functionality.
Anthem.Manager.AddScriptForClientSideEval("window.location = 'http://www.google.com';");
Yes, it uses reflection and so do others but apart from other implementation of AJAX that I've seen and worked with, Anthem.NET utilizes the pages viewstate. It may not seem like much at first but it is an integral part of a solid AJAX solution that others have either ignored or didn't bother with. The reason that it works so well for me is that the project I implemented this solution on requires authentication and I have to be able to know this during a callback. Other solutions left me in the dark, Anthem.NET didn't. I can now access my user’s information and check his authentication as well.
Another slick feature of this is the Pre, Post and Cancel callback JavaScript events.
function Anthem_PreCallBack() {}
function Anthem_CallBackCancelled() {}
function Anthem_PostCallBack() {}
By adding one or all of these to your page, you're able to display a floating "Loading..." <div> while processing occurs or prompt the user to opt out of the selected event. Since there is really no page processing visual cue and the mouse doesn't change to an hour glass, I opted to use the "Loading..." <div> in the Pre callback event to let my users know that "something" was going on. Then, when processing was over and the DHTML updated, I was able to make the "Loading..." <div> disappear on the Post callback event. I know it's simple but it's the fore-thought of Jason that makes this brilliant.
Again, my hats off to Jason for creating this gem. I've only been using it for a week and I can't remember life without it.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u