another dropdownlist question
-
How can you tell I'm a newbie, eh? I have two dropdownlists and two textboxes. Dropdown1 lets you select a city (listr is gathered from a SQL server database) and then fills textbox1. Dropdown2 lets you select a street name for the chosen city (also gathered from a SQl server database), but I can't move the value into textbox2. It seems that on the postback, the selection is cleared from dropdown2. psuedo-code: if not ispostback { get city and move selected value to textbox1 } if ispostback { get street name and move selected value to textbox2 } What am I doing wrong? Krisman
-
How can you tell I'm a newbie, eh? I have two dropdownlists and two textboxes. Dropdown1 lets you select a city (listr is gathered from a SQL server database) and then fills textbox1. Dropdown2 lets you select a street name for the chosen city (also gathered from a SQl server database), but I can't move the value into textbox2. It seems that on the postback, the selection is cleared from dropdown2. psuedo-code: if not ispostback { get city and move selected value to textbox1 } if ispostback { get street name and move selected value to textbox2 } What am I doing wrong? Krisman
Make sure enable viewstate is true and you are not repopulating the dropdown on postback
-
Make sure enable viewstate is true and you are not repopulating the dropdown on postback
I found the answer. I was using IsPostback like everyone suggested and it was always reloading because I was repopulating teh dropdownlist. Anyway the answer is in the onSelectedIndexChanged property. That way you don't have to worry about the IsPostback. Krisman