title: What do you do when you can't use ViewState?
body: <p>I have a rather complex page that dynamically builds user controls inside of a repeater. This repeater must be bound during the Init page event before <code>ViewState</code> is initialized or the dynamically created user controls will not retain their state.</p>
  
  <p>This creates an interesting Catch-22 because the object I bind the repeater to needs to be created on initial page load, and then persisted in memory until the user opts to leave or save.</p>
  
  <p>Because I cannot use <code>ViewState</code> to store this object, yet have it available during Init, I have been forced to store it in Session.</p>
  
  <p>This also has issues, because I have to explicitly null the session value during non postbacks in order to emulate how <code>ViewState</code> works.</p>
  
  <p>There has to be a better way to state management in this scenario. Any ideas?</p>
  
  <p><strong>Edit:</strong> Some good suggestions about using <code>LoadViewState</code>, but I'm still having issues with state not being restored when I do that.</p>
  
  <p>Here is somewhat if the page structure</p>
  
  <p>Page --> UserControl --> Repeater --> N amount of UserControls Dynamicly Created.</p>
  
  <p>I put the overridden <code>LoadViewState</code> in the parent <code>UserControl</code>, as it is designed to be completely encapsulated and independent of the page it is on. I am wondering if that is where the problem is.</p>