How to retain selected values from dropdown list??
How to retain selected values from dropdown list?? Please help.
I have two DropDownLists databound on the webform. The autopostback of the first dropdown list control is set to true. The contents of the first dropdown list is hardcoded. The contents of the second depend on the selected item in the first. In other words: The selectedvalue of the first DropDownList is passed as a parameter for the query at the basis of the second DropDownList's datasource. And this works: Whenever I click on an item in the first DropDownList, the dependant items are shown in the second DropDownList.
If I click submit then the specific rows from the DB will be pulled based on the values selected from dropdown list 1 and dropdown list 2.
The second ddl is populated inside the postback method. SO everytime the page is postback/refreshed the default value gets selected.
Problem: as the postback method is called everytime the page is postback so it sets the value of ddl2.selectedValue="ANY" instead of selecting a specific value from the dropdown list 2. And that's why always all the values are pulled from the DB. Can anyone suggest any solution to that please please?
Thanks
|