WebPartZoneBase.RestoreVerb 属性

定义

获取对 WebPartVerb 对象的引用,该对象使最终用户能够将区域中的 WebPart 控件还原为正常大小。Gets a reference to a WebPartVerb object that enables end users to restore WebPart controls in a zone to normal size.

public:
 virtual property System::Web::UI::WebControls::WebParts::WebPartVerb ^ RestoreVerb { System::Web::UI::WebControls::WebParts::WebPartVerb ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.WebParts.WebPartVerb RestoreVerb { get; }
member this.RestoreVerb : System.Web.UI.WebControls.WebParts.WebPartVerb
Public Overridable ReadOnly Property RestoreVerb As WebPartVerb

属性值

使用户能够还原 WebPartVerb 控件的 WebPartA WebPartVerb that enables end users to restore WebPart controls.

属性

示例

下面的代码示例演示如何使用 WebPartZone 控件上的 RestoreVerb 属性。The following code example demonstrates the use of the RestoreVerb property on a WebPartZone control. 要使代码示例正常运行,您需要 HelpVerb 属性的 "示例" 部分中的所有代码。For the code example to work, you need all the code from the Example section of the HelpVerb property.

下面的代码示例部分来自分部类,并包含用于切换是启用还是禁用还原谓词的代码。The following part of the code example is from the partial class, and contains the code that toggles whether the restore verb is enabled or disabled.

protected void CheckBoxList1_SelectedItemIndexChanged(Object sender, EventArgs e)
{
  foreach (ListItem item in CheckBoxList1.Items)
  {
    WebPartVerb theVerb;
    switch (item.Value)
    {
      case "close":
        theVerb = WebPartZone1.CloseVerb;
        break;
      case "export":
        theVerb = WebPartZone1.ExportVerb;
        break;
      case "delete":
        theVerb = WebPartZone1.DeleteVerb;
        break;
      case "minimize":
        theVerb = WebPartZone1.MinimizeVerb;
        break;
      case "restore":
        theVerb = WebPartZone1.RestoreVerb;
        break;
      default:
        theVerb = null;
        break;
    }

    if (item.Selected)
      theVerb.Enabled = true;
    else
      theVerb.Enabled = false;
  }
}
Protected Sub CheckBoxList1_SelectedItemIndexChanged(ByVal sender As [Object], ByVal e As EventArgs)
  Dim item As ListItem
  For Each item In CheckBoxList1.Items
    Dim theVerb As WebPartVerb
    Select Case item.Value
      Case "close"
        theVerb = WebPartZone1.CloseVerb
      Case "export"
        theVerb = WebPartZone1.ExportVerb
      Case "delete"
        theVerb = WebPartZone1.DeleteVerb
      Case "minimize"
        theVerb = WebPartZone1.MinimizeVerb
      Case "restore"
        theVerb = WebPartZone1.RestoreVerb
      Case Else
        theVerb = Nothing
    End Select

    If item.Selected Then
      theVerb.Enabled = True
    Else
      theVerb.Enabled = False
    End If
  Next item

End Sub

此代码示例的另一部分是承载自定义 WebPart 控件并包含用户界面(UI)的网页。The other part of the code example is the Web page that hosts the custom WebPart control and contains the user interface (UI). 请注意,区域中的声明性 <RestoreVerb> 元素设置 Description 特性文本的值,当用户将鼠标指针放在谓词菜单中的谓词上时,它将显示为工具提示。Notice that the declarative <RestoreVerb> element in the zone sets the value for the Description attribute text, which appears as a ToolTip when a user positions the mouse pointer over the verb in the verbs menu.

<asp:WebPartZone ID="WebPartZone1" Runat="server">
  <CloseVerb Text="Close WebPart" />
  <HelpVerb Text="View Help" />
  <ExportVerb Text="Export WebPart Definition" />
  <DeleteVerb Text ="Delete WebPart" />
  <MinimizeVerb Description="Minimize the control" />
  <RestoreVerb Description="Restore the control" />
  <ZoneTemplate>
  </ZoneTemplate>  
</asp:WebPartZone>
<asp:WebPartZone ID="WebPartZone1" Runat="server">
  <CloseVerb Text="Close WebPart" />
  <HelpVerb Text="View Help" />
  <ExportVerb Text="Export WebPart Definition" />
  <DeleteVerb Text ="Delete WebPart" />
  <MinimizeVerb Description="Minimize the control" />
  <RestoreVerb Description="Restore the control" />
  <ZoneTemplate>
  </ZoneTemplate>  
</asp:WebPartZone>

在浏览器中加载页面后,将页面切换到目录显示模式,并向页面添加 TextDisplayWebPart 控件(如果尚未添加)。After you load the page in a browser, switch the page into catalog display mode, and add the TextDisplayWebPart control to the page, if it has not been added. 使用最小化谓词来最小化控件,并注意还原谓词变为可见。Use the minimize verb to minimize the control, and note that the restore verb becomes visible. 您可以使用此复选框来启用和禁用还原谓词。You can use the check boxes to enable and disable the restore verb.

注解

当控件最小化时,RestoreVerb 属性引用的还原谓词将显示在区域中每个 WebPart 控件的谓词菜单中。The restore verb referenced by the RestoreVerb property appears within the verbs menu of each WebPart control in a zone, when a control is minimized. 谓词出现在所有页面显示模式下的菜单中。The verb appears in the menu in all page display modes.

恢复控件之前,控件会将其扩展回其正常大小。Restoring a control expands it back to its normal size after the control has been previously minimized.

适用于

另请参阅