M
muesliflakes
I am building a PageTemplate system that features Dynamic Templates,
this class extends System.Web.UI.Page.
A template is selected based on user preference and the Page Controls
are created both before and after the controls from the content page.
I have built a preferences page that alows the user to change the
layout
of the page but and this is throwing an exception
System.Web.HttpException: Failed to load viewstate. The control tree
into which viewstate is being loaded must match the control tree that
was used to save viewstate during the previous request.
I don't really want to turn of state tracking for the components that
are part of the layout areas of the page so I was wondering how I
could handle this state management issue.
Cheers David... I have included the calling method that builds up the
page
protected override void OnInit(EventArgs e)
{
// Get a TEMPLATE by looking up a user preference.
ITemplateLayout layout = TemplateLayout;
// Call Before content methods
layout.PageStart ( this, Controls );
layout.InsertHead ( this, Controls );
layout.PageMiddle ( this, Controls );
layout.BeforeForm ( this, Controls );
layout.BeforeContent ( this, MainForm.Controls );
// Load Content controls from content page
for(int i = 0; i < ContentControls.Count; i++)
{
MainForm.Controls.Add( ContentControls );
}
// Call after content methods
layout.AfterContent ( this, MainForm.Controls );
Controls.Add ( MainForm );
layout.AfterForm ( this, Controls );
layout.PageEnd ( this, Controls );
base.OnInit(e);
}
this class extends System.Web.UI.Page.
A template is selected based on user preference and the Page Controls
are created both before and after the controls from the content page.
I have built a preferences page that alows the user to change the
layout
of the page but and this is throwing an exception
System.Web.HttpException: Failed to load viewstate. The control tree
into which viewstate is being loaded must match the control tree that
was used to save viewstate during the previous request.
I don't really want to turn of state tracking for the components that
are part of the layout areas of the page so I was wondering how I
could handle this state management issue.
Cheers David... I have included the calling method that builds up the
page
protected override void OnInit(EventArgs e)
{
// Get a TEMPLATE by looking up a user preference.
ITemplateLayout layout = TemplateLayout;
// Call Before content methods
layout.PageStart ( this, Controls );
layout.InsertHead ( this, Controls );
layout.PageMiddle ( this, Controls );
layout.BeforeForm ( this, Controls );
layout.BeforeContent ( this, MainForm.Controls );
// Load Content controls from content page
for(int i = 0; i < ContentControls.Count; i++)
{
MainForm.Controls.Add( ContentControls );
}
// Call after content methods
layout.AfterContent ( this, MainForm.Controls );
Controls.Add ( MainForm );
layout.AfterForm ( this, Controls );
layout.PageEnd ( this, Controls );
base.OnInit(e);
}