one dropdown list affecting another dropdown list

I am desgining a website using VB.NET wherein the data items of one dropdown list depends on the selection of a data item in the previous dropdown list

something similar to selection of country USA from 1st dropdown list...triggers 2nd dropdown with list of states in USA

How can this be accomplished....

Any help will be appreciated...

Thanks & Best Regards...

6/18/2008 7:16:20 AM 91979 articles. 4 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 40
Get it on Google Play
Get it on Apple App Store

hi boy,

first I suggest turn on auto postback on first dropdownlist. In select index changes(first dropdownlist) - select value on second dropdownlist 

My blog is here.

Please remember to 'Mark as Answer' if this post answered your question!
6/18/2008 7:55:24 AM


One  what  i want  to  know  is  that  ..are  fetching  the   data of  both dropdownlists  from  database   or  just  putting  it  manually....

If  using  Manually,  then  check  the  below sample code.

 protected void drplst1_SelectedIndexChanged(object sender, EventArgs e)
        if (drplst1.SelectedItem.Text == "USA")
            drplst2.Visible = true;

                       drplst2.SelectedItem.Text = "California";


          //Do something


Hope  this  helps..... 


Click "Mark As Answer" if it helped you.

Welcome to TALIB's World

6/18/2008 8:05:19 AM

hi...thanks for the reply...

I want to do the above operation by using AJAX

also, I am using SQL database tables to populate data in both the dropdownlists....

How do I implement it?

Thanks again.

6/18/2008 8:57:51 AM


Check  this  out  for  implementing  it  with  a  database...

Hope this  helps.... 


Click "Mark As Answer" if it helped you.

Welcome to TALIB's World

6/18/2008 9:08:43 AM


Firstly, you can fill with a mutiple level array to generate a client dropdownlist.

Please check this:

It will generate all the information to the client at once time.

You can also use AJAX UpdatePanel to achieve it directly, please install the 'ASP.NET 2.0 AJAX Extensions 1.0':


    <asp:ScriptManager ID="ScriptManager1" runat="server">
    <asp:DropDownList ID="DropDownList1" runat="server"  AutoPostBack="true"
        <asp:ListItem>Please Select</asp:ListItem>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:DropDownList ID="DropDownList2" runat="server">
                <asp:ListItem>Please Select</asp:ListItem>
            <asp:AsyncPostBackTrigger ControlID="DropDownList1"  EventName="SelectedIndexChanged" />

  Code Behind:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        DropDownList2.Items.Add("Please Select");

        if (DropDownList1.SelectedIndex == 1)
        else if (DropDownList1.SelectedIndex == 2)

 Hope it helps.


Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
6/20/2008 3:07:25 AM

Similar Artilces:

Selection in one dropdown list effecting the visibility of another dropdown list
I have two drop down lists. They are not databound. We'll called them dropdownlist1 and dropdownlist2.Basicly, I want people to choose an object in the first dropdownlist. Depending on their selection, it will make certain items in dropdownlist2 invisible.Currently my thought is to have something in the lines of the following (In the dropdownlist1 - SelectedIndexChanged - Postback being set to Auto)if dropdownlist1.text = "Such and such" then(this is where I would declare which options are available)However, I do not know the proper syntax of saying make the following item...

Dropdown list bound to another dropdown list
I have two dropdown lists on my page. The first contains a list of names and the second contains a list of hardware devices. My problem is: When i choose a name from the first dropdown i need the second to become populated with their related devices. This works fine, however if i then change the name in the first dropdown list, it adds another set of devices to the devices dropdown list. The way i want it to work is to refresh the devices dropdown when the name is changed. So that only that persons related devices show up (in the second dropdown)  Any help would be much apprecia...

Filter dropdown list from another dropdown list
Help Please!!! I am trying to filter the data in a dropdown list from information chosen in another dropdown list. 1st table has modification types, 2nd table has modifications. When the user chooses the modification type needed, then only those modifications should appear in the 2nd list. mydata7 = New SqlDataAdapter("Select * from ModificationList ", myconnection) ds7 = New DataSet mydata7.Fill(ds7, "table") Dim dr7 As DataRow ddlModification.Items.Add("Please select Modification ...") ...

How to combind two dropdown list values into one dropdown list?
Hi All, I refered some websites, they are combinding two dropdown list values into single, but i don't know .Net will support it or not? If any body knows it plz tell me how to achieve it?? EX: Go to and select Functional Area dropdown list there u can see main & sub category names in one dropdown list!!!   Thanks, Aswath.  hi just concatenate , or - for ex:Dropdownlist1.Datatextfield= maincategory & "," & Subcategory Regards,M.VenkatesanMy Blog : http://venkat-dotnetsamples.blogspot.comPlease remember to click “Mark as Answer” on the pos...

How to get value from first dropdown list to second dropdown list
Hi Does soneone know hot to get value from first dropdown list to second dropdown list or remove it from seond dropdown list? I have a web form page. On the page, there are two dropdown lists, one Add button, and one Remove button . First dropdown list has four list items. Second one does not have list item yet. When select a item from first dropdown list, then click "add" button. I want it to apear in the second dropdown list without reload the page. Or select item from second dropdown list, and click "Remove" button. it will remove from second list. Please help. &nb...

Filling a dropdown list, based on a selection from another dropdown list
This seemed like a simple venture, and may be, but with my limited knowledge, I am having a problem... Basically, I have a page that is gathering information. I want a user to be able to select a value from a dropdown list... On Auto postback I would like to make a second listbox visible and bind data to it based on the selection from the first. (While keeping the value of the first listbox available) Right now I am filling my dataset with the tables used in the page load event and setting my second listbox.visible to false. in the SelectedIndex_change event of the first...

Populate a Dropdown List based on the value of another Dropdown List
 Hi ALL,    I have two Dropdown List.I need to Populate second Dropdown List based on the value of first Dropdown List.I am n't using Update Panel.Pls suggest me RegardsSri ASP.NET AJAX Cascading DropdownDarrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!   just populate second dropdown in SelectedIndexChanged event of the first dropdown. Muhammad ShoaibSoftware Engineer,Lahore, (U/C)--------------------------------Mark it as ANSWER if it Helps U   Check out this link with co...

Can I populate a Dropdown list in a GridView from another Dropdown list
Hi there, I have a Gridview control that contains 2 DDLs. The first one is populated on page load (from a Generic list in the code behind) and is working with no problems. I want to populate the 2nd DDL by making a selection in the first DDL which in turn would call a DB method and cause a postback. I've tried using the "OnSelectedIndexChanged" method for the DDL and the "FindControl" method for the 2nd DDL, but the GridView can't find it on Postback and throws an error. I've also tried using the "onSelectedIndexChanged" method for the GridView bu...

Populate dropdown list based on selected value in another dropdown list
I have a datagrid (grdCar) that contains two dropdown listboxes (ddlCarManf and ddlCar). When the user clicks the "Edit" link and places the grid into edit mode, they select a value in ddlCarManf. Based on the selected value in ddlCarManf, I need to then populate ddlCar with a list of cars for which the selected manufacturer makes (I'm using ddlCarManf.SelectedValue to query the database).  I bind my datagrid in the page_load event as: If Not Page.IsPostBack Then    BindGrid() End If Here is my control (ddlCarManf) as is appears within grdCar in ...

dropdown list in 2003
hi all i have problem in 2003 when i take integer from dropdownlist and then make any function suh as drop down list have value from data base and the displaymember is integer 30,50 etc and this function for adding the displaymember to another value take from textbox dim x,r,s as integer x=cost.selectedindex() or any selected for dropdownlist (selecteditem ,displaymember ,selectedindex ......etc) r=textbox1.text s=r+x textbox2.text=s dont give  any solution  in the textbox2 thanks amani       Hi amani I am sorry  I dont know wha...

DropDown List Validatoin in
I have 2 Dropdownlists.   The first Dropdown list ('dropdownlist1') has 4 selections a user can choose from.   What I am trying to do is if a user selects a certain selection (say Selection1) that in the 2nd dropdownlist (dropdownlist2) there would be a 2nd selections they can choose from.    So if that 'Selection1' from the 'dropdownlist1' was not select, then there would only be 1 selection under 'dropdownlist2'. Try the ASP.NET AJAX CascadingDropdown.Darrell Norton, MVPDarrell Norton's BlogPlease mark this ...

automatically generating content in a dropdown list based on the selection of another dropdown list
hi i currently have a "categories" dropdown list i'm using to help filter data in a datagrid (have it setup using data and table adapters). i've introduced another dropdown list (called subcategories) to filter the datagrid so it only displays records that fit in both the category and all works fine, but i'm wanting to set it so the subcategories dropdown list gets generated on the client-side depending on the category selected. does anybody have any quick tutorials or a quick explination on how i could do this? am i missin...

VB.Net Dropdown list item issues
I have created a form that has a drop down list. It is a static drop down list that is not bound to a datasource I have added the lists and values in the Items section in properties and named the ID but i dont know if i have to do anything else to get it to work, do I need to have something in the DataTextField or the DataValueField. If i dont can someone please also let me know what code i need behind it, i have at the moment the following Str += "&extype=" + extype.DataTextField if this is not right for this type of drop down box what is I have tried e...

Move List Box Items to another List Box in
 Please helping to solve this problem.i need the code in  Something to get you started: Default.aspx <table border="0"> <tr> <td> <asp:ListBox ID="ListBox1" runat="server" Rows="10" Width="100" SelectionMode="Multiple"> <asp:ListItem>James</asp:ListItem> <asp:ListItem>Kumar</asp:ListItem> <asp:ListItem>Ravi</asp:ListItem> <asp:ListItem>Reshmi</asp:ListItem> <asp:ListItem>Rachel</asp:ListItem> <asp:List...

Web resources about - one dropdown list affecting another dropdown list -

Psychological and sociological issues affecting space travel - Wikipedia, the free encyclopedia
... and physiological issues involved with such a mission that remain to be worked out, there are also a number of behavioral issues affecting the ...

Facebook battling bug affecting link posts
Many page admins have been struggling with link posts lately, unable to upload an image to go along with the post. The image that goes along ...

Elder Christofferson Provides Context on Handbook Changes Affecting Same-Sex Marriages - YouTube
Elder D. Todd Christofferson of the Quorum of the Twelve Apostles of The Church of Jesus Christ of Latter-day Saints reaffirmed the Church’s ...

Your say, SA: The Sunday Mail’s 2015 survey on the big issues affecting our state - AdelaideNow Search ...
THIS is your chance to have a say on the big issues affecting South Australia.

Carlton Coach Mick Malthouse says indecision over contract likely affecting Bryce Gibbs
Carlton coach Mick Malthouse has urged playmaker Bryce Gibbs to make a decision on his playing future soon in order to ensure that his form does ...

Are your pets trying to kill you? Zoonosis: Infections Affecting Humans and Animals
The positives of pet ownership have been extensively chronicled. People who live with a dog or cat, multiple studies have confirmed, are generally ...

Queensland - The State We're In live interactive forum to cover the issues affecting you
QUEENSLANDERS will get to quiz state government ministers directly on the big issues affecting their lives and have input on how to make this ...

Fatty liver disease: the frightening epidemic affecting one in three Australians
For years, John Hatty was a senior businessman travelling the world. The former scientist's job with a mining company took him to many fine restaurants ...

MRP speculation affecting Brent Harvey's preparation
Veteran midfielder says speculation over his possible suspension is affecting his preparation for preliminary final against the Swans.

How technology is affecting our relationships and sex lives
All over the world people are allowing technology to affect their relationships and their sex lives. It seems that our obsession with all things ...

Resources last updated: 1/15/2016 6:57:31 AM