Well, not really gruelsome, but its definitely interesting.
I had a small demo of AJAX working with ASP.net 2.0 and of course - it works :).
AJAX now offers an easy to use framework that can be used to build really rich web applications.
What I did with it was a really simple demo that just queries the time from the server based on the values selected in the client side Combo Box. And the page fetches the values from the server WITHOUT REFRESHING. Oh of course thats what it is supposed to do.
Well, lets get to know HOW.
First of all you will need to download the AJAX Assemblies from here. Once done, just create a small ASP.Net project. Add a reference to AjaxPro.2.dll and you are good to go. Be sure you use the HTML controls on the page (they load faster).
For a method to be "callable" from the client side, it needs to be an "AjaxMethod".
Include the AjaxPro namespace as -
And then define your method in the cs file as -
public string GetCurrentServerTime(string sType)
if (sType == "SHORT")
if (sType == "LONG")
The AjaxMethod attribute actually takes care that the method can be called from the client side.
In addition to this, there are two small changes that you need to do on the server side -
1. Add the following entry to your web.config file (under System.Web) -
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
2. And then Register the type with AJAX with the following statement in the Page_Load()
Thats it on the server side.
On the client side, I simply have a combo box that tells the format in which I want my time and the texbox that just displays the time.
<option value="SHORT" selected="selected">Short Time</option>
<option value="LONG">Long Time</option>
<option value="UNIV">Universal Time</option>
<input type="text" id="timetext" />
AJAX.Samples._Default.GetCurrentServerTime(document.all.TimeFormat.value,getTime_callback); // asynchronous call
// This method will be called after the method has been executed and the result has been sent to the client.
document.all.timetext.value = res.value;
The first method "getTime()" actually gives a call to the server side method. It specifies two parameters - the first one is the sType parameter that your server side method expects. The second one is the callback method that will be invoked once the data is fetched from the server.
In the callback method, we simply assign the res.value to the textbox.
Although, I have tried to give you a starter here on the AJAX stuff, this link would provide a lot more samples for you to take a look.
Also, there is another article on msdn that talks about AJAX development with ASP.Net.