How to dynamically switch PageLayout and MasterPage of SharePoint Publishing page?

后端 未结 6 2083
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-23 07:58

To improve both the editing and displaying experience of SharePoint WCM Publishing pages I would like to be able to switch to a special set of Masterpage/PageLayout when in edit

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-23 08:42

    Trying to bend The SharePoint to your will again? ;)

    I feel your pain. I'm using 2 ways to get similar behaviour:

    A container control to condionally render parts of pages, I think like you suggested. Initially I needed it to hide parts of the page when some field had a specific value so no html was rendered. See wrapper controls. The control itself is very simple, it needs a [ParseChildren(false)] on its class and the render method does not call the base render if the condition is not met. You can extend this to display en entirely different page to an editor and designer although it would all still live in the same page. I guess you could strip out the part used by the analist and put it in its own usercontrol but thats not very maintainable.

    Secondly, the form page, e.g. "/Pages/Forms/EditForm.aspx?ID=1", gives a clean view of all the fields on a publishing page.. no design to get in the way. (I use a control on all page layouts that provides 1 click access to this and the current pages library and shows the content type and page layout used. Quite useful when building WCM sites.)

提交回复
热议问题