Follow me on Twitter at
FYI, I'm blogging most of my stuff over at More Wally now.
You might want to add my rss feed to your reader at:
ASP.NET Podcast Show #11 - Intro to Ajax and the Ajax Library for .NET - Wallace B. McClure

Wallace B. McClure

All About Wally McClure - The musings of Wallym on Web, HTML5, Mobile, Xamarin.iOS, Xamarin.Android, and Windows Azure.


Visual Studio Magazine Column Personal Blog


Book Authors




Georgia Tech Bloggers



ASP.NET Podcast Show #11 - Intro to Ajax and the Ajax Library for .NET





Note (Added on 9/11/2005): Check out the Interview with Michael Schwartz in Show #15.


Show Notes:


Before looking at the code samples, understand that the client ids may not be 100% accurate in all situations.  It is best to use the ClientId property of the necessary controls to get the appropriate property name.


Code Sample (basic Ajax)

Client Site Code:

function sState2_onchange() {

    var iStateIndex = document.forms[0].sState2.selectedIndex;

    var sValue = document.forms[0].sState2[iStateIndex].value;

    AjaxFunctions.GetCityRecords(sValue, GetCityRecords_CallBack);



function GetCityRecords_CallBack(response){

    var ds = response.value;

    var i = 0;

    var iLength = 0;

    if (response.error != null){





    if ((ds.Tables != null) && (ds.Tables[0].Rows.length > 0))


        iLength = document.getElementById("sCity2").options.length;

        document.getElementById("sCity2").visible = true;

        for(i=0; i<iLength; i++)


            document.getElementById("sCity2").options[0] = null;



        for(i=0; i<ds.Tables[0].Rows.length; i++)


            document.getElementById("sCity2").options.add(new Option(ds.Tables[0].Rows[i]["City"],ds.Tables[0].Rows[i]["tblCityId"]))





        alert("Error: " + response.request.responseText);

        document.getElementById("sState2").visible = false;






Server Side Code:


      public System.Data.DataSet GetCityRecords(int iState)


            int i = 0;

            DataSet ds = new DataSet();

            DataTable dt = new DataTable();

            DataRow dr;

            dt.Columns.Add(new DataColumn("tblCityId", System.Type.GetType("System.Int32")));

            dt.Columns.Add(new DataColumn("City", System.Type.GetType("System.String")));

            if (iState == 1)


                  dr = dt.NewRow();

                  dr["tblCityId"] = 1;

                  dr["City"] = "Knoxville";


                  dr = dt.NewRow();

                  dr["tblCityId"] = 2;

                  dr["City"] = "Nashville";




            return (ds);




Code Sample (html control from server)

Client Side Code:

function sState3_onchange(stateid){

    HtmlControlUpdate('AjaxFunctions.ReturnCitys', 'City3Display', stateid);



Server Side Code:


      public System.Web.UI.HtmlControls.HtmlSelect ReturnCitys(string State)


            System.Web.UI.HtmlControls.HtmlSelect ctrl = new System.Web.UI.HtmlControls.HtmlSelect();

            ctrl.ID = "sCity3";

            ctrl.Attributes.Add("onchange", "alert('hi');");

            if (State == "1")



                  ctrl.Items.Add(new ListItem("Knoxville", "1"));

                  ctrl.Items.Add(new ListItem("Nashville", "2"));


            return ctrl;




Taufique said:

More Documentation & Real-Time Example needed.
# August 17, 2005 5:15 AM

Scott Cate - said:

I'm wondering how anyone could think atlas is quite limited, if nothing has been released or announced about it, or has it and I missed it? Brad, what do you think is (or will be) limited about atlas? Also, what is your source?
# August 21, 2005 9:45 PM

ShauryaAnand said:

So Cool!! Great stuff.. i like the way it works...!!
# August 29, 2005 12:45 PM

Jason Gross said:

AJAX.NET offers a really nice wrapper for the basic XMLHTTP remote services. He really extends the power of it, and removes you having to define your own transported data layout/protocol. You can get to coding without having to manage how the "what is being sent" is formatted.
# September 2, 2005 6:52 AM

Nuri Kevenoglu said:

AFLAX (at least XAMLON's implemetation) is not complete yet and no one knows when it will be!... Meanwhile, AJAX has almost taken over the world! ;)
# September 6, 2005 10:47 PM