New WikiEditPage’s in SharePoint 2010 are great. Users finally may place web parts anywhere on the page and they don’t need any cumbersome ContentEditorWebPart’s with odd “Edit RTF” buttons.
Not pretty. How to get rid of it? SharePoint supports an undocumented file property called “HidePageUnghostMessageV4”. Based on its name I suppose its sole purpose is to hide the message when the page is unghosted (i.e. customized). There seems to be a bug in the rendering code because when I set the property to “true”:
only the hyperlink for reverting disappears:
It’s possible that it’s not a bug but a feature but I would more appreciate if the flag worked by completely disabling the warning and not only the hyperlink.
public class CustomWikiEditPage : WikiEditPage
protected override void OnPreRender(EventArgs e)
ScriptManager.RegisterStartupScript((Page)this, typeof(WikiEditPage), "unghostWarning", "", true);
The ordering of the statements is crucial here because if the base method call was first then the ScriptManager would emit the original script.
Don’t forget to place an entry into the SafeControl list, too. I created a Visual Studio solution for all of this and you may download it and deploy to your farm.
Now open your page in the SharePoint Designer and change the Inherits attribute in the Page directive from Microsoft.SharePoint.WebPartPages.WikiEditPage to Ondrejsv.CustomWikiEditPage.CustomWikIEditPage (or whatever you call your custom class) and add a new Assembly directive for SharePoint to find the class (you may omit this directive if you place the full name in the Inherits attribute, of course):
No more the yellow pesky warning:
Note that any other warnings get displayed correctly:
Download the VS solution.