SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having trouble finding documentation on the web part zone's attributes. Can someone point me in the right direction? I have done this, and it seemed to work, but it was just a guess:

wpm.AddWebPart(report, "Zone 1", 1);

I am looking for the zone and zoneIndex...

public WebPart AddWebPart(
    WebPart webPart,
    WebPartZoneBase zone,
    int zoneIndex


share|improve this question
up vote 2 down vote accepted

First of all zoneIndex is where in the zone the Web Part should go. 0-first place, 1-second place etc. For horizontal zones its from left to right and vertical top to bottom.

By looking at the method declaration you have written in your Q I'm seeing that you are using the SPWebPartManager (or just WebPartManager) to add the Web Parts. Do not do this, use the SPLimitedWebPartManager where you instead use the id (string) of the zone like this:

spLimitedWebPartManager.AddWebPart(webPart, "Top", 0);

That would add the Web Part (webPart) to the zone with ID=Top and at the first position.

To get the ID's of the zone you can either look at the page and look for the WebPartZone controls, iterate over the control-tree in the page and find all WebPartZone controls or use the (SP)WebPartManager Zones property which gives you a collection of available zones.

share|improve this answer

What information do you need specifically?

There is much on the WebPartZone alone on MSDN:

share|improve this answer
Well, for example... Does "Zone 1", 1 = The top left web part zone? I just need the correlation of "thisZone" = zoneID Does each zone have a specific zoneid? – Anonymous Aug 4 '10 at 17:48

The zone ID is listed in the ASP page and may vary by MasterPage. The easiest way to get a quick view is to load an aspx page into SharePoint designer and look at the web part zones in code view. Look for the WebPartZone element and find the ID attribute.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.