Redigera

Dela via


WebPart.HelpMode Property

Definition

Gets or sets the type of user interface (UI) used to display Help content for a WebPart control.

public:
 virtual property System::Web::UI::WebControls::WebParts::WebPartHelpMode HelpMode { System::Web::UI::WebControls::WebParts::WebPartHelpMode get(); void set(System::Web::UI::WebControls::WebParts::WebPartHelpMode value); };
[System.Web.UI.Themeable(false)]
[System.Web.UI.WebControls.WebParts.Personalizable(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)]
public virtual System.Web.UI.WebControls.WebParts.WebPartHelpMode HelpMode { get; set; }
[<System.Web.UI.Themeable(false)>]
[<System.Web.UI.WebControls.WebParts.Personalizable(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)>]
member this.HelpMode : System.Web.UI.WebControls.WebParts.WebPartHelpMode with get, set
Public Overridable Property HelpMode As WebPartHelpMode

Property Value

One of the WebPartHelpMode values. The default is Modal.

Attributes

Exceptions

The value specified is not one of the WebPartHelpMode values.

Examples

The following code example demonstrates the use of the HelpMode property to display Help for a control in the same browser window. The first part of this example assumes the use of a custom control, TextDisplayWebPart, which is found in the Example section of the WebPart class overview.

The code example also includes an HTML page that contains fictitious Help content for the TextDisplayWebPart control. For this example to work, you must save the following code in a file named Textwebparthelp.htm and place it in the same directory of your site as the .aspx page.

<html>  
<head runat="server">  
    <title>Text Content WebPart Help</title>  
</head>  
<body>  
  <div>  
  <h1>Text Content WebPart Help</h1>  
  To make the WebPart control work...  
  </div>  
</body>  
</html>  

The final part of the example is a Web page that shows how to reference the TextDisplayWebPart control. Note that in the declarative markup, the HelpMode property value is set to Navigate, and the code also sets the value of the HelpUrl property to the name of the HTML file that contains the Help content. Load the page into a browser, and click the help verb on the verbs menu of the WebPart control.

<%@ page language="C#" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.CS.Controls" 
             Assembly="TextDisplayWebPartCS" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      backcolor="#99cccc">
        <parttitlestyle font-bold="true" forecolor="#ffffff" />
        <partstyle
          borderwidth="1px" 
          borderstyle="Solid" 
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            width="350px" 
            HelpMode="navigate"
            HelpUrl="TextWebPartHelp.htm" />
        </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>
<%@ page language="VB" %>
<%@ register tagprefix="aspSample" 
             Namespace="Samples.AspNet.VB.Controls" 
             Assembly="TextDisplayWebPartVB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <asp:webpartmanager id="WebPartManager1" runat="server" />
    <asp:webpartzone
      id="WebPartZone1"
      runat="server"
      backcolor="#99cccc">
        <parttitlestyle font-bold="true" forecolor="#ffffff" />
        <partstyle
          borderwidth="1px" 
          borderstyle="Solid" 
          bordercolor="#81AAF2" />
        <zonetemplate>
          <aspSample:TextDisplayWebPart 
            runat="server"   
            id="textwebpart" 
            title = "Text Content WebPart" 
            width="350px" 
            HelpMode="navigate"
            HelpUrl="TextWebPartHelp.htm" />
        </zonetemplate>
    </asp:webpartzone>
  </form>
</body>
</html>

Remarks

Use the HelpMode property to determine how a browser will display Help content for a control. The following table lists the effects of the various Help modes on a browser when Help content for a WebPart control is displayed.

Help mode Browser behavior
Modal Opens a separate browser window, if the browser has this capability. A user must close the window before returning to the Web Parts page.
Modeless Opens a separate browser window, if the browser has this capability. A user does not have to close the window before returning to the Web page.
Navigate Replaces the Web Parts page in the browser window.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

The personalization scope of this property is set to Shared and can be modified only by authorized users. For more information, see PersonalizableAttribute and Web Parts Personalization Overview.

Applies to

See also