Click here to Skip to main content
15,942,964 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two dropdowns select task and other select sub task....when i select sub task based on the selected task category it retains on the dropdown...for that i changed the ViewStateMode to enabled....However when i click on my submit button it takes the first value from the sub task dropdown and fills the database with those values....

taskDrpDown- ViewStateMode: Enabled Autopostback: True
subTaskDrpDown - ViewStateMode: Enabled AutopostBack: False

also page_load has(!IsPostback){//code}




submit_click{//code to submit all the entries to database}

Am i going wrong somewhere with the postback and all.....??

Please Help!!

Thanks in advance!
Naveen Kumar Tiwari 24-Feb-15 2:18am    
I think Somewhere your's drop down value get clear...before click on submit button or after click on submit debugger and rectify the problem..
Member 11472226 24-Feb-15 2:40am    
of no help....!! tried but subTaskDrpDown.SelectedItem takes the First value only

check if you are binding values to taskDrpDown after submit button click.
Your drop-down list is getting rebound and hence it would not able able to retain the selected value.

you should just set the dropdownlist.selecteditem =previously selected item
Share this answer
Put if statement on page load where you are binding these dropdowns like below

//Bind Code of dropdown1
Code of dropdown2
Share this answer

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

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