I hope I can explain this properly.
I have a grid that is part of our 3rd party shopping cart software. This grid has a row of quantity text boxes into which the customer enters how many of each thing they want to buy.
I put this grid inside a panel so I can set it on or off with
myPanel.Visible=true;
I also have a button to show and one to hide using the above code method.
If I enter a value into a textbox and then click the hide button and then click the show button, when the panel reappears the values are zero. If I then reload the page (browser reload) then the value returns as it was originally. It’s a pretty good magic trick but not what I need. What am I doing wrong?
Eventually I want to select a date from a calendar while it is hidden but that is not in play yet… just the show/hide buttons.
Thanks
This sounds like the correct behaviour of
ASP.NET WebFormsandViewStatemyPanelis set to invisible which on the server side means that the HTML for the panel is not generated (this can be confirmed by looking the generated HTML).ViewStateto repopulate the panel.A possible solution is to instead hide the panel (
<div) on the client-side. This will also have the benefit of not making a round trip to the server to just enable/disable the panel.