This is another self note article for me. I have been recently working on the page layouts and wanted to ensure web parts are added to the hidden web part zone only programmatically. I wanted to ensure end users are not aware of web part zone and hide adding, editing, or removing web parts interface for end users.
First I thought this might be tricky and may require some custom coding. Upon doing some quick research on web part zone properties and thanks to this wonderful MSDN forum entry, I came across “AllowLayoutChange” property which can be used to ensure “Add a Web Part” is hidden while page is in edit mode.
<%@ Register Tagprefix=”WebPartPages” Namespace=”Microsoft.SharePoint.WebPartPages” Assembly=”Microsoft.SharePoint, Version=22.214.171.124, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<WebPartPages:WebPartZone runat=”server” AllowLayoutChange=”false” AllowPersonalization=”false” FrameType=”TitleBarOnly” ID=”MainZone” Title=”Main Zone” Orientation=”Vertical”><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
Hope this quick tip would help someone.