How to display the listitems when the item has selected in the main dropdownlist

Posted by Sumasri under ASP.NET on 6/29/2012 | Points: 10 | Views : 760 | Status : [Member] | Replies : 1
Hello Friends
I have a question.. Please suggest me the responding code for this.
I have taken 3 dropdownlists, in the first dropdownlist have added item groups like cars, bikes etc.,
If I select the car item then the corresponding car names have to be displayed in the second dropdownlist at the same time the third dropdownlist will be hided
and like for the bike item.

Thanks
suma.

sumasri


Responses

Posted by: Kamalakanta.Nayak09 on: 6/29/2012 [Member] Starter | Points: 25

Up
0
Down
Simple In side the Combobox1 fire event you just call a fill method which will retrive data from db and bind in Combobox2.
In Combobox1 do AutoPostBack="True"
like Ex:-
<pre lang="cs">protected void Combobox1_SelectedIndexChanged(object sender, EventArgs e)

{
FillMethod(Combobox1.SelectedValue);
}</pre>
public void FillMethod(int CategoryId)
{
//Fetch data from db where id=CategoryId
//Bind data into Combobox2
}

Thanks,
K.K

Sumasri, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response