Populating a DropDownList using AJAX and ASP.NET
page 4 of 5
by Ramaprasad Potturi
Feedback
Average Rating: 
Views (Total / Last 10 Days): 189967/ 2541

The Sample Application

The sample application uses a pair of DropDownList controls. A change in the selected value of the first drop-down list should populate the second drop-down list with a new collection of items. This paired behavior is found in many applications, such as a Country-State pair and a Category-Product pair. We have chosen to discuss the Country-State DropDownList pair. In traditional web applications, a change in the value of the Country DropDownList results in the web page posting back to server in order to populate the States DropDownList. In our example, we will populate the States DropDownList by retrieving state data from the server using AJAX, without submitting the entire form to the server.

In this section, first we will discuss the CountriesAndStates.xml and CountriesAndStates.xsl files, and then the CountryStateXml class which is used to get country and state data from the XML file. Next, we will discuss the start page of our project, which is AjaxClient.aspx. We will then discuss our JavaScript files, AjaxVariables.js and AjaxScript.js. You will find core AJAX code in the AjaxScript.js file. Finally we will talk about the AjaxServer.aspx page, which handles the AJAX requests.

CountriesAndStates XML and XSL Files

The CountriesAndStates.xml file stores the names of all countries and their states. The format of this XML file is shown below (Listing 2). Each country is represented as a single country node, and all of its states are represented as child nodes. At present this XML file has only three countries and some of the states of these countries. You can edit this XML to add other countries and states.

Listing 2 – CountriesAndStates.xml File

<country name="USA">
    <state>Alabama</state> 
    <state>Alaska</state> 
    <state>Arizona</state> 
    <state>Arkansas</state> 
</country>

The CountriesAndStates.xsl file has the transformation logic for converting one form of XML into another form of XML. This transformation takes a country name as an input parameter, and returns its corresponding states in an XML string.

CountryStateXml class

The CountryStateXml class is used to get country or state data in different formats depending on the method called. This class has one constructor and three public methods.  The constructor loads the CountriesAndStates.xml file into an XPathDocument. The public method GetCountryList returns a list of countries as an ArrayList. The second method GetStateList returns a list of states for a given country as an ArrayList. The third method GetStatesXMLString returns an XML document containing all the states for a given country name, along with the country name.

AjaxClient Page

The start page of our sample application is AjaxClient.aspx and Figure 1 shows it viewed in a browser. This page has two DropDownList server controls. The HTML markup of this page is given in Listing 3. The onchange event of the Country DropDownList is tied to the JavaScript function CountryListOnChange and is shown in bold text in the following markup. We will discuss the CountryListOnChange function later in this section.

Figure 1 – AjaxClient.aspx Page in a Browser

Listing 3 – HTML of AjaxClient.aspx page

<form id="Form1" method="post" runat="server">
    <asp:DropDownList id="countryList" onchange="return CountryListOnChange()" 
        style="Z-INDEX: 101; LEFT: 20px; POSITION: absolute; TOP: 28px"
        runat="server" Width="174px" Height="28px"></asp:DropDownList>
    <asp:DropDownList id="stateList" 
        style="Z-INDEX: 102; LEFT: 218px; POSITION: absolute; TOP: 28px"
        runat="server" Width="174px"></asp:DropDownList>
</form>

Listing 4 shows the code for the Page_Load method of this web page. When the page loads for the first time, this method populates the Country and State DropDownList controls using the GetCountryList and GetStateList methods of CountryStateXml class.

Listing 4 – Page_Load Method of AjaxClient.aspx Page

private void Page_Load(object sender, System.EventArgs e)
{
    CountryStateXml countryStateXml = new CountryStateXml();
    ArrayList countries = countryStateXml.GetCountryList();
    for(int index = 0; index < countries.Count; index++)
    {
        countryList.Items.Add(countries[index].ToString());
    }
    ArrayList states = countryStateXml.GetStateList(countries[0].ToString()) ;
    for(int index = 0; index < states.Count; index++)
    {
        stateList.Items.Add(states[index].ToString());
    }
}

JavaScript Code

The AjaxScript.js file includes the required AJAX script. When the selected value of the country drop-down list changes, the CountryListOnChange function is called. Now we will talk about how the asynchronous request to the server in the CountryListOnChange function works. See Listing 5.

  1. Form the request URL with the selected country in the query string.
  2. The CreateXmlHttp function (this function is explained in the earlier section, Creating an Instance of an XMLHTTPRequest Object) creates an instance of an XMLHTTP request object. If the browser does not support the XMLHTTP object, the XmlHttp variable will be set to null and the AJAX code will not be executed. If the browser supports the XMLHTTP object, an asynchronous request is submitted to the server using the XMLHTTP object.
  3. The onreadystatechange property of the XMLHTTP object is used to set the response handler for the asynchronous request. This response handler gets called for every change of readyState property of the XMLHTTP object. In our code we set the HandleResponse function as the response handler.
  4. The open method is called to initialize the request. The first parameter of the open method takes a method definition (GET, POST, etc.), in our case it’s GET. The second parameter takes the request URL. The third parameter takes a Boolean value indicating whether the request submitted is synchronous or asynchronous. In our sample it’s asynchronous, so the third parameter is set to true. Other parameters are optional; we do not use them in our application.
  5. The send method submits the request to the server. The send method's behavior is determined by the third parameter of the open method. In our case it is true, so the send function behaves as an asynchronous function, which means that the browser calls the send function and does not wait for the response to come back from the server.

Listing 5 – CountryListOnChange Function

function CountryListOnChange() 
{
    var countryList = document.getElementById("countryList");
    var selectedCountry = countryList.options[countryList.selectedIndex].value;
    var requestUrl = AjaxServerPageName + "?SelectedCountry=" 
                     + encodeURIComponent(selectedCountry);
    CreateXmlHttp();
    if(XmlHttp)
    {
        XmlHttp.onreadystatechange = HandleResponse;
        XmlHttp.open("GET", requestUrl,  true);
        XmlHttp.send(null);           
    }
}

When the response comes back from the server, the HandleResponse function (Listing 6) gets called. In fact, the HandleResponse function is called for every change of the readyState property of the XMLHTTP object. The readyState property can take a value from 0 to 4 (0=UNINITIALIZED, 1=LOADING, 2=LOADED, 3=INTERACTIVE, 4=COMPLETED). A value of 4 (i.e., COMPLETED) means that receiving the response from the server is completed and the response data is available through properties of the XMLHTTP object. For the readyState property to reach the value of 4, this property changes the value four times (i.e., from LOADING to COMPLETED), so the HandleResponse function gets called four times for each response. To make sure that the data is available in the XMLHTTP object, the XmlHttp.readyState property is compared to the value of 4 in the HandleResponse function (Listing 6).

If the readyState of the XMLHTTP instance has a value of 4, we then need to check its status property to make sure that a valid response was received. The status property holds the HTTP status code returned from the server. A value of 200 means that data received in the request is OK. Some of the other popular HTTP status codes, with which most developers are familiar, are 404 (page not found), 403 (access forbidden), and 500 (internal server error). We check that the XmlHttp.status property is 200 to make sure that the response received has a status of OK. The responseXML property of the XMLHTTP object returns an XML document. This property is useful only when the response from the server is in XML format. In our sample, the response is a list of states in XML format. If both conditions are satisfied (readyState is 4 and status is 200), we call the function ClearAndSetStateListItems with the XML document as an input parameter.

Listing 6 – HandleResponse Function

function HandleResponse()
{
    if(XmlHttp.readyState == 4)
    {
        if(XmlHttp.status == 200)
        {
            ClearAndSetStateListItems(XmlHttp.responseXML.documentElement);
        }
        else
        {
            alert("There was a problem retrieving data from the server." );
        }
    }
}

The function ClearAndSetStateListItems clears the items in the State DropDownList and populates this drop-down list with the new states list by traversing through the XML document supplied as input.

AjaxServer Page

The AjaxServer.aspx file will handle the request sent by the client-side JavaScript using the XMLHTTPRequest object. This page does not have any GUI elements. Listing 7 shows the Page_Load event handler of the AjaxServer.aspx page. This method gets the selected country name from the query string, retrieves the state names as an XML document, and then writes the XML document into the response object.

Listing 7 – Page_Load Method of the AjaxServer.aspx Page

private void Page_Load(object sender, System.EventArgs e)
{
    if(!IsPostBack )
    {
        string selectedCountry = Request["SelectedCountry"];
        if(selectedCountry.Length > 0)
        {
            Response.Clear();
            CountryStateXml countryStateXml = new CountryStateXml();
            string statesString = countryStateXml.GetStatesXMLString(selectedCountry);
            Response.Clear();
            Response.ContentType ="text/xml";
            Response.Write(statesString);
            Response.End();
        }
        else
        {
            //clears the response written into the buffer and end the response.
            Response.Clear();
            Response.End();
        }
    }
    else
    {
        //clears the response written into the buffer and end the response.
        Response.Clear();
        Response.End();
    }
}

Running Sample Code

After downloading the sample application as a Zip file, extract its contents to your wwwroot directory. Create a virtual directory in IIS with the name AjaxSample, and map it to the extracted AjaxSample folder. Using Visual Studio, open the AjaxSample.sln file and press F5 to run the application.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 1 and 6 and type the answer here:

User Comments

Title: Not working unless i refresh the page once   
Name: Istiaq
Date: 5/12/2008 12:59:38 AM
Comment:
Hi,
I found the article useful and the source code too, but i found it's not working unless i refresh the page once after it gets loaded for the first time.
Can any body advice on this?
Title: Hai   
Name: Abhishek
Date: 5/2/2008 6:13:47 AM
Comment:
Nice example
Title: fghgfhf   
Name: fghfh
Date: 5/2/2008 1:09:59 AM
Comment:
nvnvnv
Title: Superp Article   
Name: Ilayaraja
Date: 5/2/2008 12:58:55 AM
Comment:
This article is good.
Title: simple and nice   
Name: AB
Date: 5/1/2008 3:29:05 AM
Comment:
nice and clear
Title: AJAX and JAVA script problem   
Name: Developer
Date: 4/25/2008 12:31:02 AM
Comment:
Populating the dropdown using AJAX (XMLHTTP)is working well in my Web page but in the same page i have a link (Link Button).On click of the link button a confirm box pops up .If OK is clicked it redirects to anohter page.This works fine in all other page but in AJAX page alone the control is not going into server side event.It throws up "Invalid Syntax" in status bar.Please help as i am new to AJAX
Title: AJAX   
Name: ANIL
Date: 4/17/2008 7:13:59 AM
Comment:
hi
write now i am developing a web application in which i have to populate two dropdownlist
for example i want to populate first dropdownlist with country list and if we select any country from 1st dropdownlist then it should place all the states in the second dropdownlist and if we select any state from the second dropdownlist then it should give the capitals in the textbox beside that
please solve my problem its very urgent
you can mail me at aniljadhav15@rediffmail.com
Title: sdf   
Name: sdf
Date: 4/15/2008 1:00:46 PM
Comment:
adf
Title: hgjyhj   
Name: ffgfgf
Date: 4/15/2008 10:30:10 AM
Comment:
sfrfd
Title: shoaibkh   
Name: shoaib
Date: 4/9/2008 2:34:24 PM
Comment:
I really want to learn ajax for implementing it in a .net
Title: dropdown list   
Name: anu
Date: 4/4/2008 5:51:30 AM
Comment:
database retrive the value of dropdown list is selected the item display the another text box
Title: Give more easier method   
Name: Biswanath
Date: 3/31/2008 12:03:00 AM
Comment:
Give more easier method using javascript.
This is waste really becoz we don't have time to
put all state & corresponding cities. So make it more user
friendly by adding JS.
Title: dropdown   
Name: Sathish
Date: 3/26/2008 12:24:48 AM
Comment:
the value selecting on dropdownlist, should dispaly in pariticular textbox.. pls give the coding
Title: Props   
Name: newbie2vb.net
Date: 3/15/2008 3:19:43 PM
Comment:
Great article. Great example
Title: good one   
Name: kathu
Date: 3/11/2008 5:59:17 AM
Comment:
this is actally a good example...
Title: nice one   
Name: mike
Date: 3/6/2008 12:36:06 PM
Comment:
good example
Title: ajax   
Name: sukhdeep
Date: 3/2/2008 2:04:50 AM
Comment:
nice article it helps very much in my project
Title: good   
Name: cheten
Date: 2/26/2008 5:11:03 AM
Comment:
hi
this is nice article about ajax control.
Title: Thanking   
Name: Nethaji
Date: 2/21/2008 8:38:09 AM
Comment:
Its Excellently working , Realy its very useful for me,
I need to display the value from database using dropdown
Title: First time i like very much   
Name: pavan kumar
Date: 2/21/2008 4:00:27 AM
Comment:
this sample application is very nice.is is given by very clearly.thank u a lot.pls keep doing like this
Title: Interesting   
Name: Adam
Date: 2/17/2008 9:37:18 AM
Comment:
nice to learn ajax but I wanted it in VB language and not C.
Title: About Modal Popup   
Name: abhay
Date: 2/15/2008 7:32:37 AM
Comment:
hi
i m using modal popup. when my popup open, and click on ok then i want to go on next page. pls send code urgent.
Title: no words to say   
Name: allen
Date: 2/15/2008 6:53:00 AM
Comment:
this article was published in 2005, but i find it in 2008.
so bad
Title: great   
Name: Manish
Date: 2/14/2008 9:05:54 AM
Comment:
thanks man, for guiding on AJAX , nice
Title: nice   
Name: Puja
Date: 2/6/2008 4:44:43 AM
Comment:
nice article
puja
http://mindgrillq.blogspot.com
http://www.shopperixmall.com
Title: Good Example   
Name: Nitin Tiwari
Date: 1/21/2008 8:15:27 AM
Comment:
ya...really,,it is best example..h t
Title: Studing Ajay   
Name: Indravijay
Date: 1/9/2008 2:23:19 AM
Comment:
i was just learning how i will create my first Ajax Test page... this example make me understand of basic working of ajax... this is eraly good Approch for making new comer to learn new
Title: AJAX With ASP.NET   
Name: sekar.j
Date: 1/7/2008 7:54:16 AM
Comment:
thank u i learn more technique for ur book
Title: AJAX   
Name: Vipul
Date: 1/6/2008 1:37:30 PM
Comment:
good topic to understand AJAX technology
Title: asp.net with c#   
Name: karthick
Date: 1/2/2008 6:27:57 AM
Comment:
i want to know how to retrieve particular datafield from database using dropdownlist box pls urgent give me coding
Title: dropdownlist   
Name: arun
Date: 12/28/2007 7:45:10 AM
Comment:
plz tell me the codings.... if a item in dropdownlist is clicked another item in db should display in another dropdownlist in asp.net
Title: dropdownlist   
Name: chand
Date: 12/28/2007 7:43:40 AM
Comment:
if a item in dropdownlist is clicked another item in db should display in another dropdownlist in asp.net
Title: Pupulate two dropdown list   
Name: nitikeni
Date: 12/17/2007 4:42:00 AM
Comment:
I'm very charmed with it.
this is very cool, very handy for those guys whoever new in the ajax world.

it's very managed and understandable.keep posting that kind of sample which give some idea to learn AJAX.
Title: Pupulate two dropdown list   
Name: Avinash Pohane
Date: 12/7/2007 6:58:57 AM
Comment:
This article is in simplified way and handy.Thnk u very much.Please post more articles related to AJAX with ASP.NET which should come across in real time.Please provide full code in the tutorial.
Title: populate two dropdownlist   
Name: raghu
Date: 11/29/2007 6:43:22 AM
Comment:
hi
write now i am developing a web application in which i have to populate two dropdownlist
for example i want to populate first dropdownlist with country list and if we select any country from 1st dropdownlist then it should place all the states in the second dropdownlist and if we select any state from the second dropdownlist then it should give the capitals in the textbox beside that
please solve my problem its very urgent
you can mail me at p.raghu@yahoo.co.in
Title: using ajax in asp.net 2.0   
Name: sandeep sindwani
Date: 11/26/2007 4:27:47 AM
Comment:
currently m learning asp.net,ajax and xml. so please send me more and more samples and code of this subject.

my emailid is-sandeep_mca22@yahoo.co.in
Title: I could not get xmlhttp object   
Name: Joseph
Date: 11/16/2007 6:44:35 AM
Comment:
hpw to get the xmlhttp object and give me the and ClearAndSetStateListItems()
Title: Bind DataGrid   
Name: manuj
Date: 11/13/2007 11:33:48 PM
Comment:
How can i bind datagrid using xmlhttp object and web service.
Web method returns dataset.
Title: Populating a textbox   
Name: sara
Date: 11/5/2007 7:44:11 AM
Comment:
I am selecting one of the option from combo box n i want to show that selected value in text box using asp/vbscript.
I am not getting the property of select tag of html so tht i can read the value of combo box
My mail id is saraswati.panchakshari@gmail.com
Title: My mail ID   
Name: Archana Pataskar
Date: 10/29/2007 7:15:37 AM
Comment:
HI,
Here is my mail id:- archanapataskar@gmail.com. You can answer me on above ID.
Title: Regarding the XPathDocument   
Name: Archana Pataskar
Date: 10/29/2007 7:13:29 AM
Comment:
Hi,
I could not understand the use of XPathDocument here. Can't we use XMLDocument instead? Does it really matter? what is the impact of using XPathDocument in this? What is the difference between XPathDocument and XMLDocument?
Title: Populating a textbox   
Name: Eric C.
Date: 10/25/2007 5:22:58 PM
Comment:
I am trying to use a selection of a drop down list to populate the appropriate text fields from a database. The selection is a user and it needs to populate the user's appropriate phone and email fields. I am coding in VB.NET and any suggestions would be appreciated.

My email is: collins101@gmail.com
Title: Wel done   
Name: Archana Pataskar
Date: 10/24/2007 9:25:58 AM
Comment:
Such an interesting and informative topic!
Title: Find Datavalue fiels in dropdown list   
Name: Madhavi DAkhani
Date: 10/23/2007 3:05:08 AM
Comment:
Hello sir,
I am make a datalist and in i have taken one dropdown list and one text area so how to find which dropdown is selected and what is write in text area.
plz give answer thankx in advance.

my email-id is:

madhavidakhani@gmail.com
Title: binding the dropdown without postback   
Name: Yunus
Date: 10/19/2007 2:01:30 AM
Comment:
I am new to ajax pls send me the code to use ajax in binding the dropdown so that without postback occurs
Title: trying to populate listbox from datagrid   
Name: pranathi
Date: 10/18/2007 8:43:59 AM
Comment:
Hi
I am trying to place the checked checkboxes of datagrid to listbox using ajax

plz help me
mail id: pranathi27@yahoo.co.in
Thanks in advance
Title: How to use Ajax to bind the drop-down in asp.net   
Name: sanjeev
Date: 10/16/2007 3:25:56 AM
Comment:
Hi,
Sir I am new to ajax pls send me the code to use ajax in binding the dropdown so that no postback occurs.
Regards
sanjeev
sanjeev_mca1234@rediffmail.com
Title: ramoji999@gmail.com   
Name: ramoji
Date: 10/15/2007 7:26:49 AM
Comment:
Sorry i forgot to give my Email Id :
it is ramoji999@gmail.com
Title: Want a similar example with database   
Name: Ramoji
Date: 10/15/2007 7:00:30 AM
Comment:
Hi
The example was so good, but i have an issue that i need to fetch the data from data base not from xml file my function returns a data table and i need the output of data table as items in child drop down
Pls help me in this ASAP
Title: java   
Name: david
Date: 10/13/2007 4:17:22 PM
Comment:
hai ... i am new to enter java
Title: Como lleno un combo con ajax??   
Name: Javier Rodriguez
Date: 10/11/2007 1:18:01 PM
Comment:
Solo quiero ver un ejemplo de codigo en ASP.NET como llenar un combo con AJAX,Yo Lo puedo hacer con PHP.

Mi Correo es Jaxier.Rod@Gmail.com
Title: plz help me   
Name: Mala
Date: 10/11/2007 1:00:34 AM
Comment:
hello ,

i am using drop down for country , state and city , plz tell me how can i make this in asp.net 2005 using c# by ajax
Title: Help!Help!Help   
Name: Babita
Date: 9/25/2007 6:09:48 AM
Comment:
hello sir,i m very new to AJAX. plz ans this........
How to get state value in my variable which i am using in code behind file ( Ex: string str=selectstate.selecteditem.text; )
how i get value in my local string. plz plz ans this: and one thing which is not yet clear that when we post back the page it's comes in intial mode i mean combo comes in first mode that is india state.
why.......... can u ans me plz......
Plz help. it's very urgent. Thanx in advance
My email address is: babitamca07@gmail.com
Title: akax   
Name: venkat
Date: 9/25/2007 12:30:40 AM
Comment:
Hi
this is very good and simple article about AJAX.But how can i use cache to a textbox as like in google.
if we enter text in textbox it will display all rellated which had been typed by user in previous
Title: BRAVO   
Name: Sachin Dubey
Date: 9/24/2007 3:30:13 AM
Comment:
Hi
this is very good and simple article about AJAX.But how can i use cache to a textbox as like in google.
if we enter text in textbox it will display all rellated which had been typed by user in previous
Title: ajax   
Name: Pawan
Date: 9/21/2007 7:41:08 PM
Comment:
Thanks for using ajax.......
Title: Bind Second Drop Down from Database on change of first one   
Name: ssrconstantine
Date: 8/31/2007 11:16:55 AM
Comment:
this is nice article but i want to bind Second DropDown from selected value of first drop down not from XML.
Title: Thanks   
Name: Aravind B.s
Date: 8/30/2007 8:23:53 AM
Comment:
Hi
this is very good and simple article about AJAX.But how can i use cache to a textbox as like in google.
if we enter text in textbox it will display all rellated which had been typed by user in previous.

arv_bs@yahoo.co.in
Title: Thanks   
Name: narendrasinh
Date: 8/29/2007 8:15:30 AM
Comment:
this is vary god and help ful to us so ones more thanks again and
Title: Problem with View state   
Name: Murali Dharan
Date: 8/23/2007 9:07:37 AM
Comment:
Hi,
This post is really good...I have a doubt.When you bind the data into the drop down list in client side and if we are posting the page back to the server say by a click of a button then the Selected value of the particular Drop down list can't be captured.Is there any way to capture the value of the ddl's selected data
Title: Mr   
Name: Mohammad
Date: 8/19/2007 1:19:50 PM
Comment:
Very wel done Ramaprasad. This the best artical i ever come across. Keep up the good work.
Title: ajax tutorial   
Name: ganesh shankar
Date: 8/13/2007 5:01:51 AM
Comment:
very fine topic
Title: Best article   
Name: Rajeev kumar
Date: 8/8/2007 2:25:36 AM
Comment:
This is best article.
Thanls a lot
Rajeev
Title: excelent article   
Name: sairam sadanala
Date: 8/2/2007 6:23:52 AM
Comment:
nice one
Title: sanjay   
Name: good work
Date: 7/25/2007 11:52:05 PM
Comment:
I am not too sure how to instantiate the XML in this case? Coz i dont see it as a class? Could someone help?
Title: CountryStateXml class   
Name: Gene Rajska
Date: 7/25/2007 2:40:00 PM
Comment:
To sandeep.

If you download the code sample, you will find the class.
The program works if you open it using a browser.
The problem is how to increase the dropdownlist from two to three or four.

Gene.
Title: the CountryStateXml class is not mentioned anywhere   
Name: sandeep
Date: 7/24/2007 7:12:46 AM
Comment:
the CountryStateXml class is not defined anywhere and the methods used in it are also not defined anywhere....
Title: BEST I HAV SEEN ...THANX ALOTTT!!!   
Name: sandeep
Date: 7/23/2007 8:30:24 AM
Comment:
hey my sincere thanx to for posting this article to Mr.ramaprasad potturi & Mr.Sanjay Patnaik
Title: Web Developer   
Name: Gene Rajska
Date: 7/17/2007 10:42:16 AM
Comment:
Is it possible to have 4 dropdownlists? 1 for world regions, 1 for country list or each region, 1 for state lists for each country and 1 for cities for each state.
If there are no states, then the country becomes the state. And some states have only 1 city, like Singapore and Vatican.
Anybody who can do it may email me at rajska7@gmail.com.
Thanks
Title: very good   
Name: jitendra
Date: 7/17/2007 6:17:39 AM
Comment:
very good
Title: very good   
Name: kumar
Date: 7/11/2007 8:18:54 AM
Comment:
it is good example for beginners
Title: Thanks   
Name: Brijesh Singh
Date: 7/11/2007 1:08:15 AM
Comment:
It is nice example but i want to use ms access table rather than xml file to access the Country and States,then what changes/code i have to make.Can u plz have any....idea.

Brijesh Singh
email:brijesh@cybersoftdesigns.com
Title: Thanks   
Name: Ratnesh kumar Verma
Date: 7/10/2007 9:27:26 AM
Comment:
Nice job i find my solution but one thing which is not yet clear that when we post back the page it's comes in intial mode i mean combo comes in first mode that is india state.
why.......... can u ans me plz......
my Email id is meetratnesh@gmail.com.
Title: Ajax combo   
Name: Ratnesh Kumar Verma
Date: 7/10/2007 8:15:48 AM
Comment:
hello sir plz ans this........
How to get state value in my variable which i am using in code behind file ( Ex: string str=selectstate.text; )
how i get value in my local string. plz plz ans this:
My email address is: meetratnesh@gmail.com
Title: software engineer   
Name: suneel singh
Date: 7/10/2007 7:37:36 AM
Comment:
very interesting and well notes for AJAX technology.... I really need CountriesAndStates.xml asap.

My email id is: cse.suneel@gmail.com
Title: Doubt   
Name: Sri
Date: 7/9/2007 3:49:39 AM
Comment:
Am doing how u r explained in teh above article. My requirement is when i was select teh dropdown that text has to display in the Textbox. in the debuggging am getting teh value but its not bing to the textBox plz solve my problem.

and one more thing is am useing one aspx page and one Js page.In the above ex u r using 2 aspx pages one for clent side and another for sever side. Is there any special use for tat? otherwise u r using for ur convinience. Plz give me teh reply its very imp to me plz plz thanx in advance.

My id is sri4u_926@yahoo.com
Title: How can i access a dropdown list inside a grid view from codebehind.   
Name: Vimal Joseph
Date: 7/6/2007 12:36:24 PM
Comment:
Hello ,
i have one problem -How can i access a dropdown list inside a grid view from codebehind.
I placed a dropdown list inside gridview. But am not able access it from code behind for populating data.

Please help me,
Title: CountryStateXml   
Name: Nasim
Date: 6/29/2007 9:00:25 AM
Comment:
very interesting and well notes for AJAX technology.... I really need CountriesAndStates.xml asap. My email id is

nasimrizwee@gmail.com
Title: CountryStateXml   
Name: razana
Date: 6/28/2007 6:17:26 AM
Comment:
Nice presentation and please send me CountryStateXml class file.....

My id:razanabanu@gmail.com
Title: Good work   
Name: Suneel
Date: 6/27/2007 2:37:59 AM
Comment:
Nice article
Title: Thank you   
Name: Lokesh
Date: 6/25/2007 3:13:42 AM
Comment:
Thank you so much.. it helps me lot... I was wondering how to use ajax in asp.net.. you solved out my problem....
Title: Good Job   
Name: manoj mevada
Date: 6/24/2007 3:01:49 AM
Comment:
thanks Ramaprasad,

This article is really useful.

--Manoj
Title: Useful   
Name: SathyaNarayanan
Date: 6/21/2007 10:15:10 AM
Comment:
Its Really Usefull.
Title: Superb And Fantastic   
Name: Prakash and Maapi
Date: 6/21/2007 10:13:36 AM
Comment:
Thanks a lot.I just started Ajax.Its very Interesting
Title: helpful article   
Name: Nihath
Date: 6/21/2007 6:14:48 AM
Comment:
Hi,
now i somewhat satiesfiesd with your article. keep it up.
Title: Help   
Name: Najef
Date: 6/16/2007 12:41:35 AM
Comment:
Hello,

I like yur artikle but have problem. I need to build my web site using AJAX. Can u build for me?
Title: Very good article   
Name: Surya
Date: 6/13/2007 7:21:55 AM
Comment:
This article is in simplified way and handy.Thnk u very much.Please post more articles related to AJAX with ASP.NET which should come across in real time.Please provide full code in the tutorial.
Title: Thanks   
Name: Jagdish Kumar
Date: 6/12/2007 1:46:23 AM
Comment:
Thank u
this is really a good one!!!
Title: Excellent   
Name: YB
Date: 6/9/2007 12:00:49 PM
Comment:
Great tutorial and sample, Simplified and very handy. Will definitrly help me in my ASP.NET coding
Title: The Best   
Name: Jaydit Chitre
Date: 6/5/2007 6:37:24 AM
Comment:
The contents r Described in Very simplified Language and can be easily applicable to similar applications in which one wants to implement AJAX.
Title: countriesindropsown   
Name: pavan naidu
Date: 5/30/2007 4:43:09 AM
Comment:
Hi,
i m trying to populate all countries name in my dropdlownbox in my .net 2.0 application pls help me ouot..
Title: Excellent   
Name: Sachin Singhal
Date: 5/29/2007 6:26:54 AM
Comment:
This is really is good one. I just started to learn AJAX. so try to post more and more article keeping in mind for beginers.
sachin.aks@rediffmail.com
Title: Excellent   
Name: Goutham
Date: 5/28/2007 3:03:41 AM
Comment:
I learning Ajax And ASP.net so it will help me,plz send more info and code sample .
goutham.madipally@yahoo.com
Title: Very Good   
Name: Hanif_TCPL
Date: 5/26/2007 1:41:06 AM
Comment:
hi,
This is a grate artical for begineer,
I learning Ajax And ASP.net so it will help me,plz send more info and code sample .
mulanihanif@yahoo.co.in
Title: Very Good   
Name: Chakravarhty
Date: 5/24/2007 5:24:10 AM
Comment:
It's Nice

Thanks
Title: Method missing   
Name: Akhlesh Chauhan
Date: 5/22/2007 11:27:48 PM
Comment:
hi
its nice one
but some method left out from you please post all related methods .

Thnaks for you article
Title: Hi   
Name: 007
Date: 5/18/2007 6:00:03 AM
Comment:
Hi Ramaprasad Potturi,

You have done a great job. I was searching for a Ajax articles but everywhere it was giving me the unwanted things for beginner.. Its really a simple and good article. I appriciate ur work behind this. Thankig You. Please post more articles related to the Ajax with ASP.Net. And in this article you have skipped some of the methods to extract from the xml and other things. Please do post all.

Thanks a lot...

Good Work
Title: Good   
Name: Good
Date: 5/18/2007 5:53:38 AM
Comment:
This article hepled a lot as I am a beginer to Ajax.. Good one .. Please post more and more good articles related to the Ajax.

Thanks a lot
Title: Problem   
Name: Tushar patel
Date: 5/15/2007 10:23:59 AM
Comment:
hello,
i got this message.. please help me out.
" The type or namespace name 'CountryStateXml' could not be found (are you missing a using directive or an assembly reference?)"

what setting I have to do to solve this..
thanks
ideaphilips@yahoo.com
Title: My Testing   
Name: It is my testing
Date: 5/14/2007 6:50:31 AM
Comment:
Hi i am using ajax
Title: For this Article   
Name: pravin
Date: 5/14/2007 1:37:49 AM
Comment:
Its really excellent.thanks
Title: On Ajax   
Name: Rohit
Date: 5/12/2007 4:30:33 AM
Comment:
I learn something new about ajax thanks
Title: Populating Dropdown using Ajax   
Name: Ganesan S
Date: 5/10/2007 2:12:36 AM
Comment:
Thank you for given this wonderful example let me try and tell you the result later
Title: stock management   
Name: karthika
Date: 5/10/2007 1:46:48 AM
Comment:
i need how the stock management is done in cshop.
Title: Software Engineer   
Name: Roshan Indika - Sri Lanka
Date: 5/9/2007 8:28:48 AM
Comment:
This is excellent. very simple and it is included every thing. explanation is very understandable. Keep up good work and share with us in this site. Thanks you
Title: Excellent Work   
Name: SriRam
Date: 5/8/2007 11:45:25 PM
Comment:
You have done a very good job.This article is very simple and excellent for the people who are new to AJAX.
The code as well as the explanation is very good.

Thanks and well done for this simple and good article.
Title: Nice Work As a Demo   
Name: Simple is beautiful
Date: 4/25/2007 10:51:31 AM
Comment:
The article is easy to understant and traight to the point. Yes, as quite a few people said that it is not getting the view state or lack of database as data source, but come on, this is a demo and it is more than pretty good.
Title: Fantastic example of populating dropdown.   
Name: Ankan Pal
Date: 4/23/2007 9:52:02 PM
Comment:
This is the example I was looking for quite some time. We can infact ping a database server. Its really a good example.
Title: Dropdown SelectedValue is not populationg   
Name: Sri Rama Krishna G
Date: 4/17/2007 4:35:29 AM
Comment:
It's really a good example. But I'm facing a small problem.

I have 3 dropdowns. dd1, dd2 and dd3.
Based on dd1, dd2 will fill and based on dd2, dd3 will fill.

It's population values properly.

While storing values in the database, dd2.selectedvalue is giving 0.

Can you please help me in this problem.

Thanks & Regards,
Sri Rama Krishna G
Title: my email   
Name: nooshin
Date: 4/12/2007 11:17:00 AM
Comment:
my mail is nooshin_sjd@yahoo.com
Title: about this sample project   
Name: nooshin
Date: 4/12/2007 10:16:13 AM
Comment:
hi
you article is the best one that i searched about dropdown+ajax+country+city
you know i m from iran and there is no way to buy this sample complitly coud you help me and get your CountryStateXml()(AjaxSample.dll) classe i have this in dll mode please????????????????/
Title: AJAX   
Name: Amit Dave
Date: 4/10/2007 6:20:48 AM
Comment:
Hi! Ram I have this first time & it;s really a good one for learner. Thanks! would appreciate if u can give more examples like this.

thanks!
Title: Test   
Name: Lalit
Date: 4/9/2007 7:41:22 AM
Comment:
Hi,
This article is usefull for Ajax....

Thanks
Title: AJAX   
Name: Amit Dave
Date: 4/6/2007 9:12:57 AM
Comment:
Hi,
This is a great exmpl u have taken it was realy very useful one. Hope we will get more examples and methodologies.
Title: Values from the database   
Name: Tony
Date: 3/28/2007 2:03:11 AM
Comment:
Hi,i am getting my dropdown values from 2 database tables linked with an ID,i am struggling to figure out how this is going to wrok
Title: AJAX DropDown   
Name: Sheetal
Date: 3/15/2007 2:18:14 AM
Comment:
The code is not working on safari on mac. I need it to work on mac safari as well with dynamically drop downs populating from databse
Title: Countrystatexml class   
Name: Nav
Date: 3/14/2007 6:42:25 AM
Comment:
it's ok but how to create countryandstatexml class it uses three public methods getcountries where is the definition for them and also in ajaxclient page how can we create object for countryandstatexml answer immediately urgent
Title: good   
Name: sunny
Date: 2/26/2007 2:30:21 AM
Comment:
but i have another problem i fill the another dropdown in drop down i fill the value succ... but not value enter to the sql server because this value not in view code
Title: good   
Name: sunny
Date: 2/22/2007 12:18:15 AM
Comment:
but i want to drop down fill by the sql server and second drop down when i select the first drop down
Title: Good   
Name: Anil
Date: 2/14/2007 4:39:53 AM
Comment:
Good Statment and Thanx for Vary Eissy to Understand ur code
Keep it up.
Title: Exemplary   
Name: tvks
Date: 2/14/2007 3:51:37 AM
Comment:
As much as my title is in english language, this article is exemplary among many other articles.
Title: AJAX Beginers   
Name: ramshretty megavath
Date: 2/14/2007 2:52:14 AM
Comment:
Thank u
this is really a good and brief explanation about ajax.nice
.............ram........it is excellent...
thanks again
Title: HelpFull   
Name: venkat prasad j
Date: 2/13/2007 1:45:15 PM
Comment:
its excelent with sample code and explanation keep it up !
Title: Fantastic Article   
Name: Vishal Jadhav
Date: 2/13/2007 4:54:49 AM
Comment:
Its a very nice article. It explains AJAX in a short and simple way so that any guy can be interesting in learning AJAx after reading this article.

Vishal
Title: Very Good Article   
Name: Krunal.Shaholia
Date: 2/7/2007 5:15:08 PM
Comment:
very good article.easy to understand
Title: Nice one.!   
Name: Rajendra Golla
Date: 2/7/2007 2:17:00 AM
Comment:
Really a nice job.keep it up..!
Title: No feedback   
Name: No feedback
Date: 2/6/2007 6:11:50 PM
Comment:
No feedback
Title: Ajax   
Name: Rakesh kumar
Date: 1/31/2007 4:55:17 AM
Comment:
Excellant
Thanks
Title: Nice Article   
Name: Debadutta Swain
Date: 1/27/2007 3:07:23 PM
Comment:
It's really a nice article to learn AJAX but could you please tell me how to bind data in datagrid using AJAX.

Please send me the response to my mail id - debaswain@rediffmail.com
Title: dr   
Name: Sam
Date: 1/26/2007 9:19:51 PM
Comment:
very interesting presentation of AJAX..thank you.
Title: HAI   
Name: joby joseph
Date: 1/24/2007 3:44:47 AM
Comment:
The Article given Regarding Ajax is vey nice.thanks is for ur efforts
Title: Quicky   
Name: Ravi
Date: 1/23/2007 8:06:22 AM
Comment:
Good one for a starter!
Title: Very Good Article   
Name: Ajay c
Date: 1/18/2007 8:23:17 AM
Comment:
Nice reading article, good to see samples of AJAX coming through.
Title: Good Article   
Name: Dipali
Date: 1/18/2007 6:17:21 AM
Comment:
Hello,

This is really very good article for learn ajax.

can u give some idea for upload file (copy file from source to destination) using ajax?

-Dipali
Title: great article   
Name: premkumar
Date: 1/10/2007 9:28:32 AM
Comment:
before reading this article...i dont even know basics of ajax..but now..i have a satisfaction of learning about AJAX to an extent.thanks. for ur helping hand
Title: Good Artical   
Name: jaimeen Modi(mca)
Date: 1/5/2007 5:46:52 AM
Comment:
hi,
this is a good artical but i want to fill frist combobox dynamically from the database.
so i am confusing regarding to the xml file.
hoe can i create xml file during run time.
any sugetion pls send me on : modijaimin.mca@gmail.com

ok,
thanks again.....
Title: Good   
Name: Joydip
Date: 1/5/2007 4:54:34 AM
Comment:
Hi,

This is an excellent article. Keep it up. Please find my blog at:--

http://aspadvice.com/blogs/joydip/

_Joydip
Title: gr8 work ...   
Name: Anil Sood
Date: 1/3/2007 1:55:24 AM
Comment:
Good insight into AJAX for beginners ..

Anil Sood
Title: Good   
Name: Deepti
Date: 1/1/2007 5:32:37 AM
Comment:
Good and informative...Gives a precise but clear picture of AJAX to a beginner like me.
Title: ajax   
Name: don
Date: 12/25/2006 6:39:22 AM
Comment:
great
Title: Great   
Name: Raghavan
Date: 12/22/2006 12:18:22 PM
Comment:
Very Good Article explained with an example simply good
Title: Very Nice   
Name: Rajendra Prasad
Date: 12/22/2006 4:47:46 AM
Comment: