Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
 AllowLayoutChange Property
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
WebPartZoneBase.AllowLayoutChange Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a value that indicates whether the layout of WebPart controls can be changed within a zone.

Namespace: System.Web.UI.WebControls.WebParts
Assembly: System.Web (in system.web.dll)

Visual Basic (Declaration)
<ThemeableAttribute(False)> _
Public Overridable Property AllowLayoutChange As Boolean
Visual Basic (Usage)
Dim instance As WebPartZoneBase
Dim value As Boolean

value = instance.AllowLayoutChange

instance.AllowLayoutChange = value
C#
[ThemeableAttribute(false)] 
public virtual bool AllowLayoutChange { get; set; }
C++
[ThemeableAttribute(false)] 
public:
virtual property bool AllowLayoutChange {
    bool get ();
    void set (bool value);
}
J#
/** @property */
public boolean get_AllowLayoutChange ()

/** @property */
public void set_AllowLayoutChange (boolean value)
JScript
public function get AllowLayoutChange () : boolean

public function set AllowLayoutChange (value : boolean)

Property Value

true if the layout can be changed; otherwise, false. The default is true.

The AllowLayoutChange property takes effect only when a zone is in a page display mode in which the layout of controls in the zone can be changed, such as DesignDisplayMode.

When AllowLayoutChange is set to false on a given zone, there are a number of actions that end users are prevented from carrying out on controls in the zone:

  • Users cannot drag controls to a different zone, rearrange controls within the zone, or move controls into the zone.

  • A number of properties that affect the user interface (UI) of WebPart controls in the zone are disabled so that users cannot edit those properties while the control is being edited using the AppearanceEditorPart and BehaviorEditorPart controls..

  • Users cannot add new controls to the zone from a CatalogPart control.

  • The close, delete, minimize, and restore verbs are not shown on controls in the zone.

Although the AllowLayoutChange property affects end users' ability to change the layout of a zone through the UI, it does not affect the ability to change the layout programmatically. For example, if AllowLayoutChange is set to false, users cannot close controls in the zone, but a developer could still call the CloseWebPart method to close controls programmatically.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins Overview.

The following code example demonstrates the declarative use of the AllowLayoutChange property on a WebPartZone control. For the full code example, including the code-behind source file and the .aspx page that contains the zone in this code, see the WebPartZoneBase class overview.

Notice that the AllowLayoutChange property is set to true, which is the default. If you change the value to false, after you load the page into a browser and switch the page into design display mode, you will not be able to drag controls within or into the WebPartZone2 zone.

Visual Basic
<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>
C#
<asp:WebPartZone 
  ID="WebPartZone2"
  Runat="server" 
  DragHighlightColor="#00ff00"
  AllowLayoutChange="true"
  EmptyZoneText="Add WebParts to this empty Zone."
  BorderWidth="2"
  BorderColor="DarkBlue"
  BorderStyle="Dashed" 
  MenuLabelText="Verbs Menu" 
  MenuPopupImageUrl="label.gif" >
  <VerbStyle Font-Italic="true" />
  <MenuLabelStyle BackColor="Lime" BorderWidth="1"  />
  <MenuLabelHoverStyle Font-Bold="true" />
  <MenuVerbHoverStyle BackColor="LightGrey" />
  <MenuVerbStyle Font-Italic="true" /> 
  <ZoneTemplate>
    <asp:Label ID="Label1" Runat="server" Title="Date" />
  </ZoneTemplate>
</asp:WebPartZone>

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker