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;