Sintaxis declarativa del control de servidor Web PropertyGridEditorPart
Actualización: noviembre 2007
Proporciona un control de editor que permite a los usuarios finales editar las propiedades personalizadas de un WebPart asociado o control de servidor. Esta clase no puede heredarse.
<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"
/>
Comentarios
PropertyGridEditorPart proporciona una interfaz de usuario (UI) genérica que permite a los usuarios editar las propiedades personalizadas de WebPart y de los controles de servidor que se encuentran en zonas WebPartZoneBase. Por el contrario, los otros controles EditorPart, por ejemplo los controles AppearanceEditorPart y BehaviorEditorPart, editan sólo propiedades existentes, orientadas a interfaz de usuario de la clase WebPart.
Para obtener más información sobre los controles PropertyGridEditorPart y los controles de elementos Web, vea Controles de elementos web ASP.NET.
Ejemplo
En el ejemplo de código siguiente se muestra cómo utilizar un control PropertyGridEditorPart. La página Web contiene una referencia declarativa a un control EditorZone, con un elemento secundario zonetemplate que contiene una referencia declarativa al control PropertyGridEditorPart.
Para obtener las definiciones del control de usuario y el control personalizado a los que se hace referencia en @ Register, vea "Ejemplo" en la información general de la clase 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>