使用功能添加 WebPartZone
在许多不同的 WSS 和 SharePoint 站点中,我们通常使用 MS Office SharePoint Designer 将 LeftNavZone 添加到 default.aspx 页面。我想编写一个功能来以编程方式执行此操作,以便它只能在某些站点上激活。
这可能吗?
我想将其添加到
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
In a number of different WSS and SharePoint sites we typically add a LeftNavZone to the default.aspx page using MS Office SharePoint Designer. I'd like to write a feature to do this programatically so it can be activated only on certain sites.
Is this possible?
I would like to add it within
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法使用功能将 WebPartZone 添加到页面。您必须手动执行此操作,但您可以使用此 AllUserWebPart
You cannot add an WebPartZone to the Pages using a feature. You will have to manually do it, but whereas you can add an webpart to the page using this AllUserWebPart
通常执行此操作的方法是使用 Visual Studio 创建站点定义,其中包含应部署到站点的所有项目,例如默认页面。这允许您控制新站点的创建。
选项 2 是创建一个可以做两件事的功能。
将一个名为 homepage.aspx 的新 aspx 部署到站点,此页面包含所需的控件等。
将
激活功能时执行的功能接收器,以编程方式将站点的主页设置为新部署的页面。
激活功能时执行的功能接收器,以编程方式将站点的主页设置为新部署的页面
The way you would normally do this is by creating a site definition using Visual Studio, in which you include all items that should be deployed to the site, like for instance the default page. This allows you control the creation of a new site.
Option 2 is creating a feature that does 2 things.
Deploy a new aspx called homepage.aspx to the site, this page contains the desired controls etc.
a feauture receiver that is executed when the feature is activated, which sets the site's homepage programmatically to be the newly deployed page.