WebPart.AllowZoneChange Property

Gets or sets a value indicating whether a user can move a WebPart control between WebPartZoneBase zones.

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

[ThemeableAttribute(false)] 
public:
virtual property bool AllowZoneChange {
	bool get ();
	void set (bool value);
}
/** @property */
public boolean get_AllowZoneChange ()

/** @property */
public void set_AllowZoneChange (boolean value)

public function get AllowZoneChange () : boolean

public function set AllowZoneChange (value : boolean)

Not applicable.

Property Value

true if the WebPart control can move between zones; otherwise, false. The default value is true.

When the AllowZoneChange property is true, and a Web page is in a display mode that allows layout changes (such as edit or design mode), a user can change the page layout by moving a control to another WebPartZoneBase zone on the page. If the property is set to false, a control cannot be moved between zones, but can still be moved within its current zone.

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

The personalization scope of this property is set to Shared and can be modified only by authorized users. For more information, see PersonalizableAttribute and Web Parts Personalization Overview.

The following code example demonstrates how to change the default setting of the AllowZoneChange property for a custom Web Parts control, so that an end user cannot move the control to a different zone. This example assumes the use of a custom control, TextDisplayWebPart, which is found in the Example section of the WebPart class overview.

The code example also uses a custom user control that enables users to change display modes on a Web Parts page. The user control is referenced by means of a Register directive near the top of the Web page that hosts the user control. For a detailed description of how to create this user control and work with display modes, see Walkthrough: Developing and Using a Custom Server Control.

No code example is currently available or this language may not be supported.

In the declarative markup for the Web Page, on the second <aspSample:TextDisplayWebPart> element, note the AllowZoneChange="false" attribute. At run time, an end user could drag the first control into WebPartZone2, but could not do the same with the second control. Load the page in a browser and use the Display Mode drop-down list control to change the display mode to design mode. Try to drag each of the WebPart controls into another zone, and note the different behavior based on the values of their AllowZoneChange properties.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: