Szerkesztés

Megosztás a következőn keresztül:


BehaviorEditorPart.Title Property

Definition

Gets or sets a title for the editor control.

public:
 virtual property System::String ^ Title { System::String ^ get(); void set(System::String ^ value); };
public override string Title { get; set; }
member this.Title : string with get, set
Public Overrides Property Title As String

Property Value

A string that is used as the title of the control. The default value is a calculated control name supplied by the Web Parts control set.

Examples

The following code example demonstrates how to use the Title property of a BehaviorEditorPart control. For the full code required to run the example, see the Example section of the BehaviorEditorPart class overview.

The following code shows how to set the title on a BehaviorEditorPart control declaratively in a Web page.

<asp:EditorZone ID="EditorZone1" runat="server" 
  style="z-index: 102; left: 340px; position: absolute; top: 90px" 
  Width="170px">
  <ZoneTemplate>
    <asp:BehaviorEditorPart ID="BehaviorEditorPart1" runat="server" 
      Title="My BehaviorEditorPart"  
      OnPreRender="BehaviorEditorPart1_PreRender" />
  </ZoneTemplate>
</asp:EditorZone>
<asp:EditorZone ID="EditorZone1" runat="server" 
  style="z-index: 102; left: 340px; position: absolute; top: 90px" 
  Width="170px">
  <ZoneTemplate>
    <asp:BehaviorEditorPart ID="BehaviorEditorPart1" runat="server" 
      Title="My BehaviorEditorPart"  
      OnPreRender="BehaviorEditorPart1_PreRender" />
  </ZoneTemplate>
</asp:EditorZone>

The next part of the code example shows how to set the value of the Title property programmatically.

Important

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

protected void Button1_Click(object sender, EventArgs e)
{
  BehaviorEditorPart1.Title = Server.HtmlEncode(TextBox1.Text);
}
Protected Sub Button1_Click(ByVal sender As Object, _
  ByVal e As System.EventArgs)
  BehaviorEditorPart1.Title = Server.HtmlEncode(TextBox1.Text)
End Sub

When you load the page in a browser, you can select Edit Mode in the Display Mode drop-down list control to switch to edit mode. You can click the verbs menu (the downward arrow) in the title bar of the Author List WebPart control, and click Edit to begin editing. When the editing UI is visible, you can see the BehaviorEditorPart control, and a button and text box positioned above it. Note that the title of the BehaviorEditorPart control is the value assigned to it in the declarative markup of the Web page. If you enter some text in the text box next to the Update EditorPart Title button, and then click the button, the title for the control is updated.

Remarks

The Title property value is displayed in the title bar of a BehaviorEditorPart control when the control is visible in edit mode. When the control is declared in a page, you can set a value for the Title attribute. If you do not supply a value for the title, a culture-specific default value is used to describe the properties that this control allows users to edit.

Applies to

See also