Gets the index position of a WebPart control within its zone.
Assembly: System.Web (in System.Web.dll)
The property indicates a Web Parts control's numerical order (or ordinal position) within its zone, relative to other controls in the zone. The WebPartManager control uses this property to track and manage its collection of Web Parts controls on a Web page.
You cannot assume that the value of the property for a control will equal the index value for the same control within the WebParts collection of the control's zone. Often a control's relative position in its zone (its value), and its index within the WebParts collection of its zone, will be different values as controls are added to and removed from zones.
The following code example demonstrates how to access the Zone and properties for a custom Web Parts control. This example assumes the use of a custom control, TextDisplayWebPart, created in the Example section of the WebPart class overview.
The code example includes 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 Web Server Control.
The second part of the code example is the Web page. There are two <asp:webpartzone> elements on the page, each representing a Web Parts zone. The first zone contains a standard Calendar control, which acts like a WebPart control at run time because it is in a zone. The second zone contains the TextDisplayWebPart control. When a user clicks the Zone Information button, the Label1 control displays the values of the property for the control, and the ID property of the zone that currently contains the control.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.