Click here to Skip to main content
15,907,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends....
I am new in programming I have 2 drop down lists one is for cites and the other one is for areas and when I select any city all the areas of that city are shown in area dropdown and its working fine but after post back drop down selectd values reset...I want selected values still remain in drop down please give any idea
Posted
Updated 18-Jul-14 8:10am
v2
Comments
Raj Negi 18-Jul-14 14:11pm    
Put your first dropdown inside the update panel.

1 solution

1. Enable Autopostback="true" in both DropDownList controls (specially for the cities).
2. In your SelectedIndexChanged of cities DropDownList ensure that you are using this if statement:
C#
if (!Page.IsPostBack)
{
    //Call your method for fill data in areas ddl here
}

Hope it helps
 
Share this answer
 
Comments
Member 10927231 19-Jul-14 3:25am    
thanks for your reply....
actually I am creating web application where customer select city from drop down and all areas of that city are shown successfully in areas drop down and it also giving me results for selected value on particular page but these drop down lists located at master page and I want while redirecting on another page the values of master page drop downs cities,areas should remain same that I have selected before redirecting.

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