EditModePanel EditModePanel EditModePanel Class


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

public ref class EditModePanel sealed : System::Web::UI::WebControls::Panel, System::Web::UI::INamingContainer
public sealed class EditModePanel : System.Web.UI.WebControls.Panel, System.Web.UI.INamingContainer
Public NotInheritable Class EditModePanel
Inherits Panel
Implements INamingContainer


///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>


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 Microsoft.SharePoint.Publishing.WebControls.EditModePanelcontrol in the same way that they would edit content contained within a <DIV> tag or a table cell.


EditModePanel() EditModePanel() EditModePanel()

Initializes a new instance of the EditModePanel object.


PageDisplayMode PageDisplayMode PageDisplayMode

Gets or sets a value that indicates whether this control is visible in Edit mode or Display mode.

SuppressTag SuppressTag SuppressTag

Gets or sets a value that indicates whether this control will render an outer <DIV> element.


RenderBeginTag(HtmlTextWriter) RenderBeginTag(HtmlTextWriter) RenderBeginTag(HtmlTextWriter)

Renders the HTML opening tag of the control to the specified writer if enabled.

RenderEndTag(HtmlTextWriter) RenderEndTag(HtmlTextWriter) RenderEndTag(HtmlTextWriter)

Renders the HTML closing tag of the control to the specified writer..

Applies to