Here are the basics of my setup:
I have a BasePage class that inherits from System.Web.UI.Page. BasePage has two properties implemented such that their get/set does so from two different items in the ViewState collection (ex this.ViewState["Year"] from the BasePage).
I have another class that then inherits from BasePage, lets call it SpecificBasePage.
Finally, I have an aspx page that inherits SpecificBasePage.
I have added break points and done much stepping through my code and have found that on the initial page load, both of my view state properties are assigned values and the values persist throughout the first page load life cycle.
When the page is posted back however, during the Page_Load event and other event handlers (when the ViewState should be loaded), both properties return null. Inspecting this.ViewState.Count shows that there are zero objects in the collection.
Can anyone think of something I might be doing somewhere that would effect the ViewState and cause this behavior?
--Addition I have isolated it to a portion of my code. On the initial load, I give the viewstate properties values in OnInit, I have found that when I move this to OnLoad, the values persist across the post back. I guess even though the added view state values persist throughout the initial page lifecycle, they are abandoned in the post back?