Cascading dropdown empty after postback
A form contains 2 cascading dropdowns. When an item is selected in the first dropdown, jQuery retrieves a list (json) from the server and fills the 2nd dropdown.
The user posts the page to the server, and when the page is 开发者_如何学编程returned the dropdown is empty because its not stored in viewstate.
What do you do in this situation? Is this the point where cascading dropdowns using jQuery and trying to make your page a little more stateless gets tedious?
You could always just set it up to pull the json from the server on page load as well, assuming that the first dropdown list has an item selected. The other option would be to pre-fill the second dropdown server-side if you know that the first dropdown has a value.
精彩评论