SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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 working on a sort of app store, where a modaldialog pops up and shows a list of web parts that can be added to the page. The real issue is when I want to add a web part to the page; the AddWebPart method requires a ZoneID, but as far as I can tell there is absolutely no easy way to get access to the available zones on a page.

I came up with the following:

  • Get the SPWebPartManager and go through its zones The SPWebPartManager requires a Web.UI.Page and I am in a modal dialog so I can't access it. Some sources speak of a .Parent property for the LimitedWebPartManager but that doesn't appear to be available in SP2010
  • Read the html SharePoint has a style tag in the head which contains one line per web part zone. I can access this and extract the ids of the zones... BUT this gets me every zone. Not just the ones that are editable. For example, it also gives me the zone that contains the search box at the top of the page.
  • Read the source of the page I would have to read in the .aspx page from the hive and regex my way through it. This would work, but frankly it's completely absurd to do this.
share|improve this question

I think you can achieve the task if you manipulate GetZoneID method of SPLimitedWebPartManager

share|improve this answer
How so? AFAIK that method only returns you the zoneid of a certain given web part. – Spongeroberto Squarepantalones Nov 22 '12 at 13:55
SPLimitedWebPartManager.WebParts will give u a webpartcollection, and enumerating over the collection you can find out the available zone ids, you can give it a try – Diptarag Nov 22 '12 at 13:58
That's handy, but what about empty zones? – Spongeroberto Squarepantalones Nov 22 '12 at 14:07

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.