I'm building a Content Management System that allows the user to dynamically change the MasterPageFile property of a page. I have 4 MasterPages setup that look different, but have all the same code on them. Each of them inherits from a base class I defined called BaseMasterPage. I got this from an excellent article on the subject located at
http://odetocode.com/Articles/450.aspx.
Each MasterPage has this one user control on it. I handle the events of the control in the MasterPage, using the RaiseBubbleEvent method inside the user control.
The problem is that the user control is bubbling its events to the MasterPage declared in the @Page directive, not the one we dynamically changed to during the page's PreInit event. Then events on the User Control bring back controls that weren't originally in the ViewState. Since I'm using an UpdatePanel, I get the "Cannot Load ViewState" error.
How can I tell the control which MasterPage to bubble its events to?
Thanks.