Syntaxe déclarative des contrôles serveur Web PropertyGridEditorPart
Mise à jour : novembre 2007
Fournit un contrôle d'édition qui permet à l'utilisateur final de modifier des propriétés personnalisées sur un contrôle WebPart ou un contrôle serveur associé. Cette classe ne peut pas être héritée.
<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"
/>
Notes
PropertyGridEditorPart fournit une interface utilisateur générique qui permet aux utilisateurs de modifier des propriétés personnalisées sur des contrôles WebPart et serveur placés dans des zones WebPartZoneBase. À l'inverse, les autres contrôles EditorPart, notamment les contrôles AppearanceEditorPart et BehaviorEditorPart, modifient uniquement des propriétés existantes orientées interface utilisateur, issues de la classe WebPart.
Pour plus d'informations sur les contrôles PropertyGridEditorPart et WebPart, consultez Contrôles WebPart ASP.NET.
Exemple
L'exemple de code suivant montre comment utiliser un contrôle PropertyGridEditorPart. La page Web contient une référence déclarative à un contrôle EditorZone, ainsi qu'un élément zonetemplate enfant qui contient, lui-même, une référence déclarative à un contrôle PropertyGridEditorPart.
Pour les définitions du contrôle utilisateur et le contrôle personnalisé qui sont référencés dans le @ Register, consultez la section « Exemple » de la vue d'ensemble de la classe pour 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>