- EditorZone Web Server Control
in ASP.NET environment,This article describes you how to work with EditorZone Web
Control.The goal of the EditorZone Web server control is that enable the end users
to personalize Web pages and save their personalized settings. This control can
serve as the primary control in the Web Parts control set for hosting EditorPart
controls on a Web page.
These control includes editing the appearance, layout, behavior, and other properties
of the visible WebPart controls. Several controls in the Web Parts control set provide
the editing features, including the EditorZone control, which is the primary control
in the Web Parts control set for hosting EditorPart controls on a Web page.
EditorPart controls
- AppearanceEditorPart -Provides an interface that enables users to customize
the visual properties of a WebPart control at run time, such as the width, height
and title.
- BehaviorEditorPart -Provides an interface that enables users to customize
behavior properties of a WebPart control at run time, such as the display of the
minimize, close, and edit buttons.
- LayoutEditorPart -Provides an interface that enables users to customize layout
properties of a WebPart control at run time, such as selecting between a minimized
and normal state, or setting the index at which the control will appear within the
target zone.
- PropertyGridEditorPart -Provides an interface that enables users to edit
custom properties at run time that are declared as part of a WebPart control.
An EditorZone control can visible in a page at run time when a Web Parts page enters
edit mode, and it makes available various EditorPart controls that can be used to
personalize WebPart controls.
the following code snippets demonstrates how to work with the EditorZone Control
in .aspx.cs page,
-
void Button1_Click(object sender, EventArgs e)
{
if (ez1.ApplyVerb.Enabled == true)
ez1.ApplyVerb.Enabled = false;
else
ez1.ApplyVerb.Enabled = true;
}
void Button2_Click(object sender, EventArgs e)
{
ez1.BorderWidth = 2;
ez1.BorderColor = System.Drawing.Color.DarkBlue;
}
void Button3_Click(object sender, EventArgs e)
{
Label1.Text = "
";
foreach (EditorPart part in ez1.EditorParts)
{
Label1.Text += part.ID + "
";
}
}
void Button4_Click(object sender, EventArgs e)
{
ez1.InstructionText = "My custom instruction text.";
}
-
in .aspx page,
-
<html >
<head id="Head1" runat="server">
<title>Examples</title>
</head>
<body>
<form id="form2" runat="server">
<asp:WebPartManager ID="wp1" runat="server" />
<uc1:DisplayModeMenuCS runat="server" id="displaymodemenu1" />
<asp:WebPartZone ID="WebPartZone1" runat="server">
<ZoneTemplate>
<asp:BulletedList
ID="BulletedList1"
Runat="server"
DisplayMode="HyperLink"
Title="Favorite Links" >
<asp:ListItem Value="http://www.gmail.com">
Gmail
</asp:ListItem>
</asp:BulletedList>
<asp:Calendar ID="Calendar1" Runat="server"
Title="My Calendar" />
</ZoneTemplate>
</asp:WebPartZone>
<asp:EditorZone ID="ez1" runat="server" >
<VerbStyle Font-Italic="true" />
<EditUIStyle BackColor="lightgray" />
<PartChromeStyle BorderWidth="1" />
<LabelStyle Font-Bold="true" />
<CancelVerb Text="Cancel Changes" />
<ZoneTemplate>
<asp:AppearanceEditorPart ID="AppearanceEditorPart1"
runat="server" />
<asp:LayoutEditorPart ID="LayoutEditorPart1"
runat="server" />
</ZoneTemplate>
</asp:EditorZone>
<hr />
<asp:Button ID="Button1" runat="server" Width="200"
Text="Enable or Disable Apply" OnClick="Button1_Click" />
<br />
<asp:Button ID="Button2" runat="server" Width="200"
Text="Set Zone BorderColor" OnClick="Button2_Click" />
<br />
<asp:Button ID="Button3" runat="server" Width="200"
Text="Display EditorPart Collection" OnClick="Button3_Click" />
<asp:Label ID="Label1" runat="server" />
<br />
<asp:Button ID="Button4" runat="server" Width="200"
Text="Set Instruction Text" OnClick="Button4_Click" />
</form>
</body>
</html>
-
- Related Links
-
7b64b56a-0420-4d21-8705-326cd1c4bd53|0|.0