Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have 2 dropdown list in my website.
The ddlist_1 give Items from database at the time of loading page.
I want when the selected index of ddlist_1 changed, ddlist_2 get Item from database.(Asp.net & C#)
Posted
Comments
Suvendu Shekhar Giri 4-Nov-15 3:05am    
That's pretty simple. What have you tried so far?
Share the relevant code.

Follow these steps-
1. Make sure that following is set for ddlist_1
HTML
AutoPostBack="True"

2. In SelectedIndexChanged for ddllist_1 write the code to bind ddlist_2
C#
protected void ddllist_1_SelectedIndexChanged(object sender, EventArgs e)
{
    string selectedValue = ddllist_1.SelectedValue.ToString();
    //do the rest coding for binding ddllist_2
    //you have ddllist_1 selected value to filter if you need
}


Hope, it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900