AJAX and .NET 2.0 platform

I’ve been without posting for a little time. Meanwhile I started (and finished) reading Daniel Woolston’s “Pro Ajax and the .net 2.0 platform” book.

In the end I’ve learned quite a lot about ASP .net 2.0, but most important, I was quite impressed with chapter 7 (well, not the chapter itself, but with the different set of libraries and frameworks for implementing AJAX in ASP.net 2.0).

From all the different libraries, maybe, Michael Schwarz’s Ajax.NET is the most famous. But there are also Jason Diamond’s Anthem (I’ll be covering it on this post), Daniel Zeiss’s ComfortASP.NET, MagicAjax.NET and Microsoft’s Atlas (especially useful for those wanting to bring some of the Ajax’s magic to the former ASP websites (please note that I’m not calling them ASP applications).

Using Anthem library it’s very straight forward, and it can be told in four major steps.

  1. Register the server-side page with the Anthem Library.
    -This is done in the Page_Load() method of the (C# or VB.Net) code-behind file.
  2. private void Page_Load()
    {
       Anthem.Manager.Register(this);
    }
  3. Identify the server-side methods that are AJAX-aware.
    -This is done by adding the [Anthem.Method] metatag before each AJAX-aware method signature.

    [Anthem.Method]
    public String myAJAXmethod():void
    {
       return “I’m an AJAX – aware method”;
    }

  4. Invoke server-side functions through Anthem from the client
    -This is done using the Anthem_InvokePageMethod(String serverSideMethod, parameters [], function callBackMethod)
    method.

  5. Handle the results returned from the server
    -This is done using the result object returned from the server

As one can see, it is pretty straightforward to use AJAX with ASP.NET 2.0. The following is the source code from a very simple AJAX + ASP.NET 2.0 application. AJAX and .NET 2.0 with Anthem

Advertisements

0 Responses to “AJAX and .NET 2.0 platform”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: