Welcome to TechNet Blogs Sign in | Join | Help

ASP.NET 2.0 and MCMS - glitches with navigation controls when switching between modes

When switching from published mode to edit mode using a template that holds the ASP.NET 2.0 navigation controls using the MCMS Site Map Provider will show an unwanted behaviour: the navigation controls will continue to show the published mode URLs. This is being caused by the fact that these controls buffer the information in viewstate. Due to the fact that switching between published and unpublished mode will cause a postback this information is being preserved.

So it is required to clear the viewstate of the navigation controls when switching between edit mode and published mode - or just to disable viewstate in unpublished mode completly and only to enable it in published mode.

In my code I added the following code to the Page_Load event to ensure that the navigation controls always show the correct links:

    protected void Page_Load(object sender, EventArgs e) 
   
        bool enableViewState = (WebAuthorContext.Current.Mode == WebAuthorContextMode.PresentationPublished); 
        this.TreeView1.EnableViewState = enableViewState; 
        this.Menu1.EnableViewState = enableViewState; 
    }

Published Tuesday, July 12, 2005 10:15 AM by Stefan_Gossner

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Tuesday, July 12, 2005 8:58 AM by AndrewSeven

# re: ASP.NET 2.0 and MCMS - glitches with navigation controls when switching between modes

I've wondered why switching to and from Edit Mode is done with a postback.

There are significant differences of context similar to navigation and it doesn't seem to need to be a postback.

I've encountered some (not so good) controls that have viewstate issues because there are different items available in edit mode than in live mode.
Thursday, August 04, 2005 4:26 PM by Stefan Goßner

# ASP.NET 2.0 and MCMS - implementing page summary controls using a custom SiteMapProvider

In my previous article I have discussed how to implement site navigation for an MCMS site using ASP.NET...
Thursday, August 04, 2005 4:32 PM by Stefan Goßner

# ASP.NET 2.0 and MCMS - implementing page summary controls using a custom SiteMapProvider and a TreeView control

In my previous article I have discussed how to implement site navigation for an MCMS site using ASP.NET...
Thursday, August 04, 2005 4:33 PM by Stefan Goßner

# ASP.NET 2.0 and MCMS - implementing page summary controls using a custom SiteMapProvider and a TreeView control

In my previous article I have discussed how to implement site navigation for an MCMS site using ASP.NET...
Sunday, February 12, 2006 2:00 PM by Andrew Connell [MVP MCMS]

# Microsoft Content Management Server 2002 Service Pack 2 Resources

Sunday, February 12, 2006 2:09 PM by Andrew Connell [MVP MCMS]

# Microsoft Content Management Server 2002 Service Pack 2 Resources

Friday, April 28, 2006 5:29 AM by Stefan Goßner

# ASP.NET 2.0 and MCMS article series

Now after MCMS 2002 SP2 has been released I would like to point you again to an article series I have...

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker