Hiding field controls in a page layout from presentation

Learn how you can use EditModePanel server control in SharePoint Server to show field controls in edit mode only with no custom code required.

Ever want to provide certain field controls to your content authors when editing a page, but never have that content appear in presentation (or display) mode? No custom code needed! One of the server controls that ships with MOSS is the EditModePanel. This control, available to developers/designers in the SharePoint Designer Toolbox under SharePoint Controls / Server Controls (SharePoint), when dropped on a page layout, will only render it’s contents when you’re in edit mode. If someone is browsing the page in display mode, the contents aren’t even rendered out.

There’s a great example of this if you check out the ArticleLeft.aspx page layout included in the Publishing Portal site template. Go into the Press Release section of a site collection created using the Publishing Portal template and create a new page using the (Article Page) Article page with image on left. Notice how there is a place to select the rolloup image? When you publish the page, notice that image you selected isn’t rendered. I’m sure this will come in handy to many folks.

Edit Mode Panel

Edit Mode Panel

Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a full stack developer who focuses on Microsoft Azure & Microsoft 365. He’s a 20+ year recipient of Microsoft’s MVP award and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s mission is to help web developers become experts in the Microsoft 365 ecosystem, so they can become irreplaceable in their organization.

Share & Comment