Good way to maintain ASP.NET bar states?
I am creating a multi-page web form in ASP.NET that uses panels for different steps, making only the panel visible for the current step. In step 1, I have a dropdown that uses a Javascript function to re-configure some of the fields in the same panel via "onchange". Obviously, since the client-side script only affects the DOM, when I go to step 2 and then back to step 1, the fields in step 1 revert to their orignal configuration even if the same dropdown is selected.
What's a good way to keep the visual state of the panels between steps? I thought about calling the onchange dropdown function on page load, but that seemed awkward. Thank!
-
Thanks for the quick replies - I think I'll try the wizards, but the AJAX solution sounds fun as well.
source to share
I think your best bet is to keep your entire state in one place, or not to maintain any state at all. The main problem you are facing is keeping your client-side state in sync with your server-side state.
Try showing / hiding panels with javascript instead of sending back if possible. If not, use some ajax to update the server side values as soon as they are selected, not when the next / previous button is clicked.
Otherwise, you can use something like the ASP.Net Ajax Toolkit tab to help with transitions.
Hope it helps!
source to share