I'm trying to persist the contents of a textbox through a postback, and I've exhausted all of my effort but can't get it working right.
What should happen is:
- User selects a radiobutton
- Depending which button was selection, a usercontrol is loaded to specify some data and a viewstate to say which enum type it's equivalent to.
- When they click save, if the UserControl is just a textbox input - the simplest), the contents are read and saved, then saved to the database with the format(the radiobutton choice) so they can be deserialized again later.
- The page posts back, and the value and format are read from the database, then the right control is loaded.
The problem is - the first time the page posts back, it works. Every other postback it resets to the default value of the textbox.
I have a very similar setup elsewhere, so I'm thinking it might be a minor thing I'd never think of. There's a lot of code, so it might be easier to talk about what to do (load the dynamic control, populate the values etc) rather than how to do it.