I Have a webpart page, which has layout as shown in picture,

WebPart Page Layout

Now I want to add a webpart to second "Top" zone of my page but I dont know how to access it, If I want to add it to first top zone I use this code,

WPMgr = web.GetLimitedWebPartManager("default.aspx", PersonalizationScope.Shared);
WebPart CmsWP = new WebPart();
this.WPMgr.AddWebPart(CmsWP, "Top", 0);


  • Hi you can check this link it may help you sharepoint.stackexchange.com/questions/9442/… Apr 23, 2012 at 13:32
  • Hi, Nope this link didn't helped at all :| ? Apr 23, 2012 at 13:34
  • 3
    You should not use the same name for different zones.
    – marco
    Apr 23, 2012 at 13:54
  • I am working on some big project made by someone, and there's many webparts and synchronized operations are happening, changing Name will simply gonna break numbers of other things :( Apr 23, 2012 at 13:59

1 Answer 1


If your page has 2 zones with the same ID you're not going to stand much chance. Check what ID the second zone has, though - web part zones are controls and you can't have two web controls with the same ID.

Note that the text 'Top' is not necessarily the same as the ID. Look at the zone's definition through something like SharePoint Designer:

<WebPartPages:WebPartZone runat="server" Title="Left" ID="CenterLeftColumn"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>

This would display the heading of 'Left', but you'd need to refer to the zone with 'CenterLeftColumn'

  • True, but can I add a webpart to a zone using its ID, not name as atm I think am using its name, if am not wrong. Cheers Apr 24, 2012 at 11:53
  • 1
    At the moment, you're using 'Top' which is probably the ID of one web part zone, and the title of Two zones. You'd need to find out the ID of the second 'top' zone. The API documentation says that AddWebPart() uses the ID of the web part zone.
    – Andy Burns
    Apr 25, 2012 at 15:18
  • I solved the problem by adding webpart manually and saving it as a template, but just for knowledge if you can us how to find ID of a page please :) Apr 26, 2012 at 7:24
  • If I get web part from my template page and add same web part into another page with the same zone Id my template has web part goes at the end of the page not the zone I want to add.
    – user28399
    Jun 5, 2014 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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