Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

EditModePanel class

Provides a container that shows or hides its child controls based on the mode of the page.

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Panel
        Microsoft.SharePoint.Publishing.WebControls.EditModePanel

Namespace:  Microsoft.SharePoint.Publishing.WebControls
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public sealed class EditModePanel : Panel, 
	INamingContainer, IParserAccessor

When a page is viewed in a Web browser it will be in one of two page display modes: Edit mode or Display mode. Readers can only view pages in Display mode. Authors can view pages in either mode. You can use the EditModePanel control to control the visibility of other controls in relation to the Display mode. For example, if you are a page designer, you can add a field to the page's content type that is only used to include business logic for page authors. You can use the EditModePanel control to allow page authors to view and edit when the page is in Edit mode yet hide the information from readers when the page is in Display mode.

You can also use the EditModePanel control to insert information only at display time while hiding it at edit time. For example, a page designer might have one set of cascading style sheet classes that should be used in Display mode and a different set that should be used only in Edit mode. The EditModePanell control has a custom run-time designer that is used when a page contains an EditModePanel control in Microsoft SharePoint Designer or Visual Studio. This control designer allows the user to edit the content inside of an EditModePanelcontrol in the same way that they would edit content contained within a <DIV> tag or a table cell.

///In this example, the EditModePanel control is used to display and ///edit two fields which drive some of the business logic of the site.   <PublishingWebControls:EditModePanel runat="server" id="BusinessLogicArea" style="margin:5px; border:solid 1px black; background-color:#7ba2d6"> <table>     <tr>   <td colspan="2" style="color:white; font-size:18px; font-weight:bold;">Product Properties</td>     </tr>     <tr>   <td style="vertical-align:top; padding-right: 20px;"> <SharePointWebControls:LookupField runat="server" id-="RelatedProduct" FieldName="Product Supplier" />   </td>   <td style="vertical-align:top;"> <SharePointWebControls:DropDownChoiceField runat="server" FieldName="Model Year" />   </td>     </tr> </table>   </PublishingWebControls:EditModePanel>      ///In this example, the EditModePanel control is used to determine///whether the CSS file included is for display or editing.   <PublishingWebControls:EditModePanel runat="server" id="GetDisplayCss" PageDisplayMode="Display" SuppressTag="true"> <link rel="stylesheet" type="text/css" href="/MyStyles/Display.css" >   </PublishingWebControls:EditModePanel>   <PublishingWebControls:EditModePanel runat="server" id="GetEditCss" PageDisplayMode="Edit" SuppressTag="true"> <link rel="stylesheet" type="text/css" href="/MyStyles/Edit.css" >   </PublishingWebControls:EditModePanel>
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

Show:
© 2014 Microsoft. All rights reserved.