[英]How to add a custom web part to a webpart page through code?
I wanna how to add a custom web part to a webpart page through code? 我想如何通过代码将自定义Web部件添加到WebPart页面? The custom web part is already deployed to the SharePoint site. 自定义Web部件已经部署到SharePoint网站。 It's a MOSS instance. 这是一个MOSS实例。
To place a web part on a page you have to use the SPLimitedWebPartManager which could be retrieved from the actual SPWeb object. 要将Web部件放置在页面上,您必须使用SPLimitedWebPartManager ,可以从实际的SPWeb对象中检索它。
After creating an instance of the web part you want to add to the page, you call the AddWebPart() method of the web part manager and pass the web part instance as a parameter. 创建要添加到页面的Web部件的实例之后,调用Web部件管理器的AddWebPart()方法并将Web部件实例作为参数传递。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.