Controle de servidor Web PropertyGridEditorPart sintaxe declarativa
Fornece um controle editor que permite aos usuários finais editar propriedades personalizadas em um tipo de WebPart ou controle de servidor. Esta classe não pode ser herdada.
<asp:PropertyGridEditorPart
AccessKey="string"
BackColor="color name|#dddddd"
BackImageUrl="uri"
BorderColor="color name|#dddddd"
BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
Inset|Outset"
BorderWidth="size"
ChromeState="Normal|Minimized"
ChromeType="Default|TitleAndBorder|None|TitleOnly|BorderOnly"
CssClass="string"
DefaultButton="string"
Description="string"
Direction="NotSet|LeftToRight|RightToLeft"
Enabled="True|False"
EnableTheming="True|False"
EnableViewState="True|False"
Font-Bold="True|False"
Font-Italic="True|False"
Font-Names="string"
Font-Overline="True|False"
Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
Large|X-Large|XX-Large"
Font-Strikeout="True|False"
Font-Underline="True|False"
ForeColor="color name|#dddddd"
GroupingText="string"
Height="size"
HorizontalAlign="NotSet|Left|Center|Right|Justify"
ID="string"
OnDataBinding="DataBinding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="Unload event handler"
runat="server"
ScrollBars="None|Horizontal|Vertical|Both|Auto"
SkinID="string"
Style="string"
TabIndex="integer"
Title="string"
ToolTip="string"
Visible="True|False"
Width="size"
Wrap="True|False"
/>
Comentários
O PropertyGridEditorPart fornece uma interface de usuário genéricas (UI) que permite aos usuários editar propriedades personalizadas em WebPart e controles de servidor que são colocados em WebPartZoneBase zonas. Em contraste, o outro EditorPart controles, como o AppearanceEditorPart e BehaviorEditorPart controles, editar somente existentes, propriedades e orientada a interface do usuário a partir do WebPart classe.
Para obter mais informações sobre o PropertyGridEditorPart e Web Parts de controles, consulte ASP.NET Web Parts Controls.
Exemplo
O exemplo de código a seguir demonstra como usar um PropertyGridEditorPart de controle. A página da Web contém uma referência declarativa a um EditorZone controle, com um filho zonetemplate o elemento que contém uma referência declarativa para um PropertyGridEditorPart de controle.
Para as definições de controle de usuário e o controle personalizado que é referenciado no @ Register, consulte "Exemplo" na visão geral de classe para PropertyGridEditorPart.
<%@ page language="VB" %>
<%@ register TagPrefix="uc1"
TagName="DisplayModeMenuVB"
Src="DisplayModeMenuVB.ascx" %>
<%@ register tagprefix="aspSample"
Namespace="Samples.AspNet.VB.Controls"
Assembly="UserInfoWebPartVB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs)
Button1.Visible = False
TextBox1.Visible = False
End Sub
Shared editControlTitle As String
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
editControlTitle = Server.HtmlEncode(TextBox1.Text)
PropertyGridEditorPart1.Title = editControlTitle
End Sub
Protected Sub PropertyGridEditorPart1_Init(ByVal _
sender As Object, ByVal e As System.EventArgs)
If Not editControlTitle Is Nothing Then
PropertyGridEditorPart1.Title = editControlTitle
End If
End Sub
Protected Sub PropertyGridEditorPart1_PreRender(ByVal _
sender As Object, ByVal e As System.EventArgs)
Button1.Visible = True
TextBox1.Visible = True
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>
User Information WebPart with EditorPart
</title>
</head>
<body>
<form id="form1" runat="server">
<asp:webpartmanager id="WebPartManager1" runat="server" />
<uc1:DisplayModeMenuVB ID="DisplayModeMenu1" runat="server" />
<asp:webpartzone id="zone1" runat="server" >
<PartTitleStyle BorderWidth="1"
Font-Names="Verdana, Arial"
Font-Size="110%"
BackColor="LightBlue" />
<zonetemplate>
<aspSample:UserInfoWebPart
runat="server"
id="userinfo"
title = "User Information WebPart"
BackColor="Beige" />
</zonetemplate>
</asp:webpartzone>
<div>
<hr />
<asp:Button ID="Button1" runat="server"
Text="Update EditorPart Title"
OnClick="Button1_Click" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
<asp:EditorZone ID="EditorZone1" runat="server">
<ZoneTemplate>
<asp:PropertyGridEditorPart ID="PropertyGridEditorPart1"
runat="server"
Title="Edit Custom Properties"
OnPreRender="PropertyGridEditorPart1_PreRender"
OnInit="PropertyGridEditorPart1_Init" />
</ZoneTemplate>
</asp:EditorZone>
</form>
</body>
</html>
<%@ page language="c#" %>
<%@ register TagPrefix="uc1"
TagName="DisplayModeMenuCS"
Src="DisplayModeMenuCS.ascx" %>
<%@ register tagprefix="aspSample"
Namespace="Samples.AspNet.CS.Controls"
Assembly="UserInfoWebPartCS" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Button1.Visible = false;
TextBox1.Visible = false;
}
private static String editControlTitle;
protected void Button1_Click(object sender, EventArgs e)
{
editControlTitle = Server.HtmlEncode(TextBox1.Text);
PropertyGridEditorPart1.Title = editControlTitle;
}
protected void PropertyGridEditorPart1_Init(object sender, EventArgs e)
{
if (editControlTitle != null)
PropertyGridEditorPart1.Title = editControlTitle;
}
protected void PropertyGridEditorPart1_PreRender(object sender,
EventArgs e)
{
Button1.Visible = true;
TextBox1.Visible = true;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>
User Information WebPart with EditorPart
</title>
</head>
<body>
<form id="form1" runat="server">
<asp:webpartmanager id="WebPartManager1" runat="server" />
<uc1:DisplayModeMenuCS ID="DisplayModeMenu1" runat="server" />
<asp:webpartzone id="zone1" runat="server" >
<PartTitleStyle BorderWidth="1"
Font-Names="Verdana, Arial"
Font-Size="110%"
BackColor="LightBlue" />
<zonetemplate>
<aspSample:UserInfoWebPart
runat="server"
id="userinfo"
title = "User Information WebPart"
BackColor="Beige" />
</zonetemplate>
</asp:webpartzone>
<div>
<hr />
<asp:Button ID="Button1" runat="server"
Text="Update EditorPart Title"
OnClick="Button1_Click" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
<asp:EditorZone ID="EditorZone1" runat="server">
<ZoneTemplate>
<asp:PropertyGridEditorPart ID="PropertyGridEditorPart1"
runat="server"
Title="Edit Custom Properties"
OnPreRender="PropertyGridEditorPart1_PreRender"
OnInit="PropertyGridEditorPart1_Init" />
</ZoneTemplate>
</asp:EditorZone>
</form>
</body>
</html>