EditorPart 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
用作驻留在 EditorZoneBase 区域中的控件的基类,用于编辑 WebPart 控件。
public ref class EditorPart abstract : System::Web::UI::WebControls::WebParts::Part
[System.ComponentModel.Bindable(false)]
public abstract class EditorPart : System.Web.UI.WebControls.WebParts.Part
[<System.ComponentModel.Bindable(false)>]
type EditorPart = class
inherit Part
Public MustInherit Class EditorPart
Inherits Part
- 继承
- 派生
- 属性
示例
下面的代码示例演示了控件的 EditorPart 声明性和编程用法。 此代码示例包含四个部分:
允许用户在 Web 部件页上更改显示模式的用户控件。
包含控件 EditorZone 的网页,其中包含区域中声明的 Web 部件控件集中的多个 EditorPart 控件,以及对自定义 WebPart 控件的引用。
一个包含自定义WebPart控件的类,以及用于编辑控件中的属性的EditorPart自定义WebPart控件。
说明在浏览器中加载页面时该示例的工作原理。
此代码示例的第一部分是允许用户更改网页上的显示模式的用户控件。 有关此控件中的显示模式和源代码的说明的详细信息,请参阅 演练:更改 Web 部件页上的显示模式。
<%@ control language="C#" classname="DisplayModeMenuCS"%>
<script runat="server">
// Use a field to reference the current WebPartManager.
WebPartManager _manager;
void Page_Init(object sender, EventArgs e)
{
Page.InitComplete += new EventHandler(InitComplete);
}
void InitComplete(object sender, System.EventArgs e)
{
_manager = WebPartManager.GetCurrentWebPartManager(Page);
String browseModeName = WebPartManager.BrowseDisplayMode.Name;
// Fill the dropdown with the names of supported display modes.
foreach (WebPartDisplayMode mode in _manager.SupportedDisplayModes)
{
String modeName = mode.Name;
// Make sure a mode is enabled before adding it.
if (mode.IsEnabled(_manager))
{
ListItem item = new ListItem(modeName + " Mode", modeName);
DisplayModeDropdown.Items.Add(item);
}
}
}
// Change the page to the selected display mode.
void DisplayModeDropdown_SelectedIndexChanged(object sender,
EventArgs e)
{
String selectedMode = DisplayModeDropdown.SelectedValue;
WebPartDisplayMode mode = _manager.SupportedDisplayModes[selectedMode];
if (mode != null)
_manager.DisplayMode = mode;
}
void Page_PreRender(object sender, EventArgs e)
{
DisplayModeDropdown.SelectedValue = _manager.DisplayMode.Name;
}
</script>
<div>
<asp:DropDownList ID="DisplayModeDropdown"
runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged" />
</div>
<%@ control language="vb" classname="DisplayModeMenuVB"%>
<script runat="server">
' Use a field to reference the current WebPartManager.
Dim _manager As WebPartManager
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
AddHandler Page.InitComplete, AddressOf InitComplete
End Sub
Sub InitComplete(ByVal sender As Object, ByVal e As System.EventArgs)
_manager = WebPartManager.GetCurrentWebPartManager(Page)
Dim browseModeName As String = WebPartManager.BrowseDisplayMode.Name
' Fill the dropdown with the names of supported display modes.
Dim mode As WebPartDisplayMode
For Each mode In _manager.SupportedDisplayModes
Dim modeName As String = mode.Name
' Make sure a mode is enabled before adding it.
If mode.IsEnabled(_manager) Then
Dim item As New ListItem(modeName + " Mode", modeName)
DisplayModeDropdown.Items.Add(item)
End If
Next mode
End Sub
' Change the page to the selected display mode.
Sub DisplayModeDropdown_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim selectedMode As String = DisplayModeDropdown.SelectedValue
Dim mode As WebPartDisplayMode = _manager.SupportedDisplayModes(selectedMode)
If Not (mode Is Nothing) Then
_manager.DisplayMode = mode
End If
End Sub
Sub Page_PreRender(ByVal sender As Object, ByVal e As EventArgs)
DisplayModeDropdown.SelectedValue = _manager.DisplayMode.Name
End Sub
</script>
<div>
<asp:DropDownList ID="DisplayModeDropdown"
runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged" />
</div>
代码示例的第二部分是网页。 它包含对控件的 EditorZone 声明性引用,其子 <zonetemplate> 元素包含对两个 Web 部件控件集控件的 EditorPart 声明性引用。 该页还引用自定义 WebPart 控件,使用 Register 程序集的指令和 <aspSample:TextDisplayWebPart> 控件的元素。
<%@ page language="c#" %>
<%@ register TagPrefix="uc1"
TagName="DisplayModeMenu"
Src="DisplayModecs.ascx" %>
<%@ 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 runat="server">
<title>
Text Display WebPart with EditorPart
</title>
</head>
<body>
<form id="form1" runat="server">
<asp:webpartmanager id="WebPartManager1" runat="server" />
<uc1:DisplayModeMenu ID="DisplayModeMenu1" runat="server" />
<asp:webpartzone id="zone1" runat="server"
CloseVerb-Enabled="false">
<zonetemplate>
<aspSample:TextDisplayWebPart
runat="server"
id="textwebpart"
title = "Text Content WebPart" />
</zonetemplate>
</asp:webpartzone>
<asp:EditorZone ID="EditorZone1" runat="server">
<ZoneTemplate>
<asp:AppearanceEditorPart ID="AppearanceEditorPart1"
runat="server" />
<asp:LayoutEditorPart ID="LayoutEditorPart1"
runat="server" />
</ZoneTemplate>
</asp:EditorZone>
</form>
</body>
</html>
<%@ page language="vb" %>
<%@ register TagPrefix="uc1"
TagName="DisplayModeMenu"
Src="DisplayModevb.ascx" %>
<%@ 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>
Text Display WebPart with EditorPart
</title>
</head>
<body>
<form id="form1" runat="server">
<asp:webpartmanager id="WebPartManager1" runat="server" />
<uc1:DisplayModeMenu ID="DisplayModeMenu1" runat="server" />
<asp:webpartzone id="zone1" runat="server"
CloseVerb-Enabled="false">
<zonetemplate>
<aspSample:TextDisplayWebPart
runat="server"
id="textwebpart"
title = "Text Content WebPart" />
</zonetemplate>
</asp:webpartzone>
<asp:EditorZone ID="EditorZone1" runat="server">
<ZoneTemplate>
<asp:AppearanceEditorPart ID="AppearanceEditorPart1"
runat="server" />
<asp:LayoutEditorPart ID="LayoutEditorPart1"
runat="server" />
</ZoneTemplate>
</asp:EditorZone>
</form>
</body>
</html>
代码示例的第三部分是一个名为 TextDisplayWebPart类的代码,并命名TextDisplayEditorPart。 在运行时,当TextDisplayWebPart控件进入编辑模式时,它会在其TextDisplayWebPart.CreateEditorParts方法中创建类的TextDisplayEditorPart实例,并将其与其他控件一起EditorZone显示在控件中EditorPart。
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace Samples.AspNet.CS.Controls
{
[AspNetHostingPermission(SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal)]
public class TextDisplayWebPart : WebPart
{
private String _contentText = null;
private String _fontStyle = null;
TextBox input;
Label DisplayContent;
Literal lineBreak;
public override EditorPartCollection CreateEditorParts()
{
ArrayList editorArray = new ArrayList();
TextDisplayEditorPart edPart = new TextDisplayEditorPart();
edPart.ID = this.ID + "_editorPart1";
editorArray.Add(edPart);
EditorPartCollection editorParts =
new EditorPartCollection(editorArray);
return editorParts;
}
public override object WebBrowsableObject
{
get { return this; }
}
[Personalizable(), WebBrowsable]
public String ContentText
{
get { return _contentText; }
set { _contentText = value; }
}
[Personalizable(), WebBrowsable()]
public String FontStyle
{
get { return _fontStyle; }
set { _fontStyle = value; }
}
protected override void CreateChildControls()
{
Controls.Clear();
DisplayContent = new Label();
DisplayContent.BackColor = Color.LightBlue;
DisplayContent.Text = this.ContentText;
if (FontStyle == null)
FontStyle = "None";
SetFontStyle(DisplayContent, FontStyle);
this.Controls.Add(DisplayContent);
lineBreak = new Literal();
lineBreak.Text = @"<br />";
Controls.Add(lineBreak);
input = new TextBox();
this.Controls.Add(input);
Button update = new Button();
update.Text = "Set Label Content";
update.Click += new EventHandler(this.submit_Click);
this.Controls.Add(update);
}
private void submit_Click(object sender, EventArgs e)
{
// Update the label string.
if (!string.IsNullOrEmpty(input.Text))
{
_contentText = input.Text + @"<br />";
input.Text = String.Empty;
DisplayContent.Text = this.ContentText;
}
}
private void SetFontStyle(Label label, String selectedStyle)
{
if (selectedStyle == "Bold")
{
label.Font.Bold = true;
label.Font.Italic = false;
label.Font.Underline = false;
}
else if (selectedStyle == "Italic")
{
label.Font.Italic = true;
label.Font.Bold = false;
label.Font.Underline = false;
}
else if (selectedStyle == "Underline")
{
label.Font.Underline = true;
label.Font.Bold = false;
label.Font.Italic = false;
}
else
{
label.Font.Bold = false;
label.Font.Italic = false;
label.Font.Underline = false;
}
}
// Create a custom EditorPart to edit the WebPart control.
[AspNetHostingPermission(SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal)]
private class TextDisplayEditorPart : EditorPart
{
DropDownList _partContentFontStyle;
public TextDisplayEditorPart()
{
Title = "Font Face";
}
public override bool ApplyChanges()
{
TextDisplayWebPart part =
(TextDisplayWebPart)WebPartToEdit;
// Update the custom WebPart control with the font style.
part.FontStyle = PartContentFontStyle.SelectedValue;
return true;
}
public override void SyncChanges()
{
TextDisplayWebPart part =
(TextDisplayWebPart)WebPartToEdit;
String currentStyle = part.FontStyle;
// Select the current font style in the drop-down control.
foreach (ListItem item in PartContentFontStyle.Items)
{
if (item.Value == currentStyle)
{
item.Selected = true;
break;
}
}
}
protected override void CreateChildControls()
{
Controls.Clear();
// Add a set of font styles to the dropdown list.
_partContentFontStyle = new DropDownList();
_partContentFontStyle.Items.Add("Bold");
_partContentFontStyle.Items.Add("Italic");
_partContentFontStyle.Items.Add("Underline");
_partContentFontStyle.Items.Add("None");
Controls.Add(_partContentFontStyle);
}
protected override void RenderContents(HtmlTextWriter writer)
{
writer.Write("<b>Text Content Font Style</b>");
writer.WriteBreak();
writer.Write("Select a font style.");
writer.WriteBreak();
_partContentFontStyle.RenderControl(writer);
writer.WriteBreak();
}
// Access the drop-down control through a property.
private DropDownList PartContentFontStyle
{
get
{
EnsureChildControls();
return _partContentFontStyle;
}
}
}
}
}
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Namespace Samples.AspNet.VB.Controls
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class TextDisplayWebPart
Inherits WebPart
Private _contentText As String = Nothing
Private _fontStyle As String = Nothing
Private input As TextBox
Private DisplayContent As Label
Private lineBreak As Literal
Public Overrides Function CreateEditorParts() _
As EditorPartCollection
Dim editorArray As New ArrayList()
Dim edPart as New TextDisplayEditorPart()
edPart.ID = Me.ID & "_editorPart1"
editorArray.Add(edPart)
Dim editorParts As New EditorPartCollection(editorArray)
Return editorParts
End Function
Public Overrides ReadOnly Property WebBrowsableObject() _
As Object
Get
Return Me
End Get
End Property
<Personalizable(), WebBrowsable()> _
Public Property ContentText() As String
Get
Return _contentText
End Get
Set(ByVal value As String)
_contentText = Value
End Set
End Property
<Personalizable(), WebBrowsable()> _
Public Property FontStyle() As String
Get
Return _fontStyle
End Get
Set(ByVal value As String)
_fontStyle = Value
End Set
End Property
Protected Overrides Sub CreateChildControls()
Controls.Clear()
DisplayContent = New Label()
DisplayContent.BackColor = Color.LightBlue
DisplayContent.Text = Me.ContentText
If FontStyle Is Nothing Then
FontStyle = "None"
End If
SetFontStyle(DisplayContent, FontStyle)
Me.Controls.Add(DisplayContent)
lineBreak = New Literal()
lineBreak.Text = "<br />"
Controls.Add(lineBreak)
input = New TextBox()
Me.Controls.Add(input)
Dim update As New Button()
update.Text = "Set Label Content"
AddHandler update.Click, AddressOf Me.submit_Click
Me.Controls.Add(update)
End Sub
Private Sub submit_Click(ByVal sender As Object, _
ByVal e As EventArgs)
' Update the label string.
If input.Text <> String.Empty Then
_contentText = input.Text + "<br />"
input.Text = String.Empty
DisplayContent.Text = Me.ContentText
End If
End Sub
Private Sub SetFontStyle(ByVal label As Label, _
ByVal selectedStyle As String)
If selectedStyle = "Bold" Then
label.Font.Bold = True
label.Font.Italic = False
label.Font.Underline = False
ElseIf selectedStyle = "Italic" Then
label.Font.Italic = True
label.Font.Bold = False
label.Font.Underline = False
ElseIf selectedStyle = "Underline" Then
label.Font.Underline = True
label.Font.Bold = False
label.Font.Italic = False
Else
label.Font.Bold = False
label.Font.Italic = False
label.Font.Underline = False
End If
End Sub
' Create a custom EditorPart to edit the WebPart control.
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
Private Class TextDisplayEditorPart
Inherits EditorPart
Private _partContentFontStyle As DropDownList
Public Sub New()
Title = "Font Face"
End Sub
Public Overrides Function ApplyChanges() As Boolean
Dim part As TextDisplayWebPart = CType(WebPartToEdit, _
TextDisplayWebPart)
' Update the custom WebPart control with the font style.
part.FontStyle = PartContentFontStyle.SelectedValue
Return True
End Function
Public Overrides Sub SyncChanges()
Dim part As TextDisplayWebPart = CType(WebPartToEdit, _
TextDisplayWebPart)
Dim currentStyle As String = part.FontStyle
' Select the current font style in the drop-down control.
Dim item As ListItem
For Each item In PartContentFontStyle.Items
If item.Value = currentStyle Then
item.Selected = True
Exit For
End If
Next item
End Sub
Protected Overrides Sub CreateChildControls()
Controls.Clear()
' Add a set of font styles to the dropdown list.
_partContentFontStyle = New DropDownList()
_partContentFontStyle.Items.Add("Bold")
_partContentFontStyle.Items.Add("Italic")
_partContentFontStyle.Items.Add("Underline")
_partContentFontStyle.Items.Add("None")
Controls.Add(_partContentFontStyle)
End Sub
Protected Overrides Sub RenderContents(ByVal writer _
As HtmlTextWriter)
writer.Write("<b>Text Content Font Style</b>")
writer.WriteBreak()
writer.Write("Select a font style.")
writer.WriteBreak()
_partContentFontStyle.RenderControl(writer)
writer.WriteBreak()
End Sub
' Access the drop-down control through a property.
Private ReadOnly Property PartContentFontStyle() As DropDownList
Get
EnsureChildControls()
Return _partContentFontStyle
End Get
End Property
End Class
End Class
End Namespace
在浏览器中加载页面,然后在 显示模式 控件上,选择 “编辑模式 ”切换到编辑模式。 单击控件标题栏中的 TextDisplayWebPart 谓词菜单(向下箭头),然后单击“ 编辑” 以编辑控件。 当编辑 UI 可见时,可以看到三 EditorPart 个控件,包括可用于编辑属性的 TextDisplayWebPart.FontStyle 自定义控件。 如果在编辑 UI 中进行了一些更改并单击“ 应用 ”按钮,则可以使用下拉列表控件返回页面浏览模式,并查看编辑更改的完整效果。
注解
该EditorPart类提供一组基本属性和方法,这些属性和方法由随 Web 部件控件集和自定义EditorPart控件一起提供的派生EditorPart控件使用。 控件 EditorPart 允许用户通过修改其布局、外观、属性、行为或其他特征来编辑关联的 WebPart 控件。
编辑用户界面(UI)由包含EditorZoneBase控件的区域组成EditorPart,在网页进入编辑模式后显示。
注释
EditorPart控件只能在派生自EditorZoneBase类的区域(如控件)内EditorZone使用。
进入编辑模式后,用户可以通过在所选控件的谓词菜单上单击编辑谓词来选择要 WebPart 编辑的控件。 一次只能编辑一个 WebPart 控件。
以下表中列出的 Web 部件控件集提供了多个派生 EditorPart 控件。 这些控件提供大多数应用程序所需的所有编辑功能。 在 Web 部件页中使用这些控件的典型方法是在元素(其中元素<zonetemplate>的<zonetemplate>子元素)中<asp:editorzone>以页面持久性格式声明这些控件。 有关代码示例,请参阅本主题的“示例”部分。
| 控制类型 | Description |
|---|---|
| AppearanceEditorPart | 编辑关联控件的外观,包括其标题文本、高度、宽度和边框属性等属性。 |
| BehaviorEditorPart | 编辑关联控件的某些行为,例如是否可以编辑、是否可以将其关闭或是否可以移动到另一个区域。 只有在共享个性化设置范围内编辑控件时,此控件才在页面上可见。 |
| LayoutEditorPart | 编辑关联控件的布局属性,例如它是处于正常状态还是最小化(已折叠)状态,以及它所在的区域。 |
| PropertyGridEditorPart | 编辑关联控件的属性(如果这些属性是在源代码 WebBrowsable 中使用属性声明的)。 |
注释
为了改进辅助功能,Web 部件控件集中提供的所有 EditorPart 控件都呈现在元素内 <fieldset> 。 该 <fieldset> 元素将用于在给定 EditorPart 控件中编辑的相关控件集进行分组,并有助于在视觉用户代理(如普通 Web 浏览器)和面向语音的用户代理(如屏幕阅读软件)的这些控件之间进行选项卡式导航。
实施者说明
若要创建自定义 EditorPart 控件,必须重写两个重要的方法。 该方法 ApplyChanges() 将编辑器控件中所做的更改应用于正在编辑的 WebPart 控件。 该方法 SyncChanges() 获取正在编辑的 WebPart 控件的当前值,以便编辑器控件可以编辑它们。 使用这两种关键方法,可以在自定义 EditorPart 控件及其正在编辑的 WebPart 控件之间获取和设置值。
如果派生自EditorPart类以创建自定义编辑器控件,可以通过在控件、用户控件或服务器控件中EditorZoneBase实现IWebEditable接口,将自定义控件WebPart添加到区域。 有关更多详细信息和代码示例,请参阅 IWebEditable 类概述。 此外,“示例”部分中的代码示例演示如何在自定义IWebEditable控件中实现WebPart。
构造函数
| 名称 | 说明 |
|---|---|
| EditorPart() |
初始化类以供继承的类实例使用。 此构造函数只能由继承的类调用。 |
属性
| 名称 | 说明 |
|---|---|
| AccessKey |
获取或设置访问密钥,使你能够快速导航到 Web 服务器控件。 (继承自 WebControl) |
| Adapter |
获取控件的特定于浏览器的适配器。 (继承自 Control) |
| AppRelativeTemplateSourceDirectory |
获取或设置包含此控件的 Page 或 UserControl 对象的应用程序相对虚拟目录。 (继承自 Control) |
| Attributes |
获取不对应于控件上的属性的任意属性(仅用于呈现)的集合。 (继承自 WebControl) |
| BackColor |
获取或设置 Web 服务器控件的背景色。 (继承自 WebControl) |
| BackImageUrl |
获取或设置面板控件的背景图像的 URL。 (继承自 Panel) |
| BindingContainer |
获取包含此控件的数据绑定的控件。 (继承自 Control) |
| BorderColor |
获取或设置 Web 控件的边框颜色。 (继承自 WebControl) |
| BorderStyle |
获取或设置 Web 服务器控件的边框样式。 (继承自 WebControl) |
| BorderWidth |
获取或设置 Web 服务器控件的边框宽度。 (继承自 WebControl) |
| ChildControlsCreated |
获取一个值,该值指示是否已创建服务器控件的子控件。 (继承自 Control) |
| ChromeState |
获取或设置部件控件处于最小化状态还是正常状态。 (继承自 Part) |
| ChromeType |
获取或设置框架 Web 部件控件的边框类型。 (继承自 Part) |
| ClientID |
获取由 ASP.NET 生成的 HTML 标记的控件 ID。 (继承自 Control) |
| ClientIDMode |
获取或设置用于生成属性值的 ClientID 算法。 (继承自 Control) |
| ClientIDSeparator |
获取一个表示属性中使用的 ClientID 分隔符的字符值。 (继承自 Control) |
| Context |
HttpContext获取与当前 Web 请求的服务器控件关联的对象。 (继承自 Control) |
| Controls |
获取一个 ControlCollection 对象,该对象包含用户界面层次结构中指定服务器控件的子控件。 (继承自 Part) |
| ControlStyle |
获取 Web 服务器控件的样式。 此属性主要由控件开发人员使用。 (继承自 WebControl) |
| ControlStyleCreated |
获取一个值,该值 Style 指示是否已为 ControlStyle 属性创建对象。 此属性主要由控件开发人员使用。 (继承自 WebControl) |
| CssClass |
获取或设置由客户端上的 Web 服务器控件呈现的级联样式表 (CSS) 类。 (继承自 WebControl) |
| DataItemContainer |
获取对命名容器的引用(如果命名容器实现 IDataItemContainer)。 (继承自 Control) |
| DataKeysContainer |
获取对命名容器的引用(如果命名容器实现 IDataKeysControl)。 (继承自 Control) |
| DefaultButton |
获取或设置控件中包含的默认按钮的 Panel 标识符。 (继承自 Panel) |
| Description |
获取或设置一个简短短语,该短语汇总部件控件的作用,以便在部件控件的工具提示和目录中使用。 (继承自 Part) |
| DesignMode |
获取一个值,该值指示控件是否在设计图面上使用。 (继承自 Control) |
| Direction |
获取或设置显示控件中包含 Panel 文本的控件的方向。 (继承自 Panel) |
| Display |
获取一个值,该值指示控件在关联 WebPart 控件处于编辑模式时是否应显示。 |
| DisplayTitle |
获取一个字符串,其中包含控件标题栏中 EditorPart 显示的标题文本。 |
| Enabled |
获取或设置一个值,该值指示是否启用 Web 服务器控件。 (继承自 WebControl) |
| EnableTheming |
获取或设置一个值,该值指示主题是否应用于此控件。 (继承自 WebControl) |
| EnableViewState |
获取或设置一个值,该值指示服务器控件是否将视图状态及其包含的任何子控件的视图状态保存到请求客户端。 (继承自 Control) |
| Events |
获取控件的事件处理程序委托的列表。 此属性为只读。 (继承自 Control) |
| Font |
获取与 Web 服务器控件关联的字体属性。 (继承自 WebControl) |
| ForeColor |
获取或设置 Web 服务器控件的前景色(通常是文本的颜色)。 (继承自 WebControl) |
| GroupingText |
获取或设置面板控件中包含的控件组的标题。 (继承自 Panel) |
| HasAttributes |
获取一个值,该值指示控件是否设置了属性。 (继承自 WebControl) |
| HasChildViewState |
获取一个值,该值指示当前服务器控件的子控件是否具有保存的视图状态设置。 (继承自 Control) |
| Height |
获取或设置 Web 服务器控件的高度。 (继承自 WebControl) |
| HorizontalAlign |
获取或设置面板中内容的水平对齐方式。 (继承自 Panel) |
| ID |
获取或设置分配给服务器控件的编程标识符。 (继承自 Control) |
| IdSeparator |
获取用于分隔控件标识符的字符。 (继承自 Control) |
| IsChildControlStateCleared |
获取一个值,该值指示此控件中包含的控件是否具有控件状态。 (继承自 Control) |
| IsEnabled |
获取一个值,该值指示是否启用控件。 (继承自 WebControl) |
| IsTrackingViewState |
获取一个值,该值指示服务器控件是否正在保存对其视图状态的更改。 (继承自 Control) |
| IsViewStateEnabled |
获取一个值,该值指示是否为此控件启用视图状态。 (继承自 Control) |
| LoadViewStateByID |
获取一个值,该值指示控件是否参与加载其视图状态,而不是 ID 索引。 (继承自 Control) |
| NamingContainer |
获取对服务器控件命名容器的引用,该容器创建唯一的命名空间,用于区分具有相同 ID 属性值的服务器控件。 (继承自 Control) |
| Page |
获取对 Page 包含服务器控件的实例的引用。 (继承自 Control) |
| Parent |
获取对页面控件层次结构中服务器控件的父控件的引用。 (继承自 Control) |
| RenderingCompatibility |
获取一个值,该值指定呈现的 HTML 将与 ASP.NET 版本兼容。 (继承自 Control) |
| ScrollBars |
获取或设置控件中 Panel 滚动条的可见性和位置。 (继承自 Panel) |
| Site |
获取有关在设计图面上呈现时承载当前控件的容器的信息。 (继承自 Control) |
| SkinID |
获取或设置要应用于控件的皮肤。 (继承自 WebControl) |
| Style |
获取文本属性的集合,该属性将在 Web 服务器控件的外部标记上呈现为样式属性。 (继承自 WebControl) |
| SupportsDisabledAttribute |
获取一个值,该值指示当控件的属性为控件的属性时,控件是否应将呈现的 |
| TabIndex |
获取或设置 Web 服务器控件的选项卡索引。 (继承自 WebControl) |
| TagKey |
HtmlTextWriterTag获取与此 Web 服务器控件对应的值。 此属性主要由控件开发人员使用。 (继承自 WebControl) |
| TagName |
获取控件标记的名称。 此属性主要由控件开发人员使用。 (继承自 WebControl) |
| TemplateControl |
获取或设置对包含此控件的模板的引用。 (继承自 Control) |
| TemplateSourceDirectory |
获取包含当前服务器控件的 Page 虚拟 UserControl 目录。 (继承自 Control) |
| Title |
获取或设置部件控件的标题。 (继承自 Part) |
| ToolTip |
获取或设置鼠标指针悬停在 Web 服务器控件上时显示的文本。 (继承自 WebControl) |
| UniqueID |
获取服务器控件的唯一分层限定标识符。 (继承自 Control) |
| ValidateRequestMode |
获取或设置一个值,该值指示控件是否检查浏览器的客户端输入是否存在潜在危险值。 (继承自 Control) |
| ViewState |
获取状态信息的字典,该字典允许跨同一页的多个请求保存和还原服务器控件的视图状态。 (继承自 Control) |
| ViewStateIgnoresCase |
获取一个值,该值指示对象是否 StateBag 不区分大小写。 (继承自 Control) |
| ViewStateMode |
获取或设置此控件的视图状态模式。 (继承自 Control) |
| Visible |
获取或设置一个值,该值指示服务器控件是否呈现为页面上的 UI。 (继承自 Control) |
| WebPartManager |
获取对 WebPartManager 与当前网页关联的控件的引用。 |
| WebPartToEdit |
获取对当前正在编辑的控件的 WebPart 引用。 |
| Width |
获取或设置 Web 服务器控件的宽度。 (继承自 WebControl) |
| Wrap |
获取或设置一个值,该值指示内容是否包装在面板中。 (继承自 Panel) |
| Zone |
获取对 EditorZoneBase 包含控件 EditorPart 的区域的引用。 |
方法
活动
| 名称 | 说明 |
|---|---|
| DataBinding |
当服务器控件绑定到数据源时发生。 (继承自 Control) |
| Disposed |
在从内存中释放服务器控件时发生,这是请求 ASP.NET 页时服务器控件生命周期的最后阶段。 (继承自 Control) |
| Init |
在初始化服务器控件时发生,这是其生命周期中的第一步。 (继承自 Control) |
| Load |
在将服务器控件加载到对象中 Page 时发生。 (继承自 Control) |
| PreRender |
在 Control 加载对象但在呈现之前发生。 (继承自 Control) |
| Unload |
从内存中卸载服务器控件时发生。 (继承自 Control) |
显式接口实现
扩展方法
| 名称 | 说明 |
|---|---|
| EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>) |
为指定的数据控件启用动态数据行为。 |
| EnableDynamicData(INamingContainer, Type, Object) |
为指定的数据控件启用动态数据行为。 |
| EnableDynamicData(INamingContainer, Type) |
为指定的数据控件启用动态数据行为。 |
| FindDataSourceControl(Control) |
返回与指定控件的数据控件关联的数据源。 |
| FindFieldTemplate(Control, String) |
返回指定控件命名容器中指定列的字段模板。 |
| FindMetaTable(Control) |
返回包含数据控件的元表对象。 |
| GetDefaultValues(INamingContainer) |
获取指定数据控件的默认值的集合。 |
| GetMetaTable(INamingContainer) |
获取指定数据控件的表元数据。 |
| SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>) |
设置指定数据控件的表元数据和默认值映射。 |
| SetMetaTable(INamingContainer, MetaTable, Object) |
设置指定数据控件的表元数据和默认值映射。 |
| SetMetaTable(INamingContainer, MetaTable) |
设置指定数据控件的表元数据。 |
| TryGetMetaTable(INamingContainer, MetaTable) |
确定表元数据是否可用。 |