Вопрос

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);

Cheers

Это было полезно?

Решение

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'

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top