WebPartZoneBase.RestoreVerb 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取对 WebPartVerb 对象的引用,该对象使最终用户能够将区域中的 WebPart 控件还原为正常大小。
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; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.RestoreVerb : System.Web.UI.WebControls.WebParts.WebPartVerb
Public Overridable ReadOnly Property RestoreVerb As WebPartVerb
属性值
使用户能够还原 WebPartVerb 控件的 WebPart。
- 属性
示例
下面的代码示例演示如何在 RestoreVerb 控件上使用 WebPartZone 属性。 要使代码示例正常工作,需要属性的 Example 节 HelpVerb 中的所有代码。
代码示例的以下部分来自分部类,包含切换还原谓词是启用或禁用的代码。
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) 。 请注意,区域中的声明性 <RestoreVerb>
元素设置属性文本的值 Description
,当用户将鼠标指针放在谓词菜单中的谓词上时,该属性文本显示为工具提示。
<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
页面(如果尚未添加)。 使用最小化谓词最小化控件,并注意还原谓词变为可见。 可以使用复选框来启用和禁用还原谓词。
注解
当控件最小化时,由 属性引用的 RestoreVerb 还原谓词将显示在区域中每个 WebPart 控件的谓词菜单中。 谓词以所有页面显示模式显示在菜单中。
还原控件后,在控件先前最小化后,会将其扩展回正常大小。