Two dropdownlist select one change data of another list. !hELP ME OUT

10 pts.
Tags:
ASP.NET
Dependant ComboBox
DropDownList
Web development
Two dropdownlist (drpcountry & drp city). i just want if i select pakistan in drpcountry other dropdownlist which is drpcity should display cities of that country it works for 1st country pk but if i select other the cities drp list dont update and show same old cities. i have true autopostback in both dropdownlist and code is below protected void Page_Load(object sender, EventArgs e) { if (IsPostBack==false) { drpcountry.Items.Add("Pakistan"); drpcountry.Items.Add("Iran"); drpcountry.Items.Add("Dubai"); drpcity.Items.Add("Islamabad"); drpcity.Items.Add("Karachi"); drpcity.Items.Add("Lahore"); } } protected void drpcountry_change(object sender, EventArgs e) { drpcity.Items.Clear(); if (drpcountry.SelectedItem.Value == "Pakistan") { drpcity.Items.Add("Islamabad"); drpcity.Items.Add("Karachi"); drpcity.Items.Add("Lahore"); } else if (drpcountry.SelectedItem.Value == "Iran") { drpcity.Items.Add("Tehran"); drpcity.Items.Add("Muskat"); drpcity.Items.Add("Damishq"); } else { drpcity.Items.Add("Doha"); drpcity.Items.Add("zaibi"); drpcity.Items.Add("inshalla go there"); } } }

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following