views:

92

answers:

1

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?

+1  A: 

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.

BBonifield
The latter requires 2 methods of filling the dropdown which seems inefficient. The former is something I had already considered. When the dropdown has been filled after the postback, the users selected option would also need to be selected. The selected value would need to be sent back to the client most probably in a hidden field. It's all starting to get rather convoluted.
Jamie Carruthers