简体   繁体   中英

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? The custom web part is already deployed to the SharePoint site. It's a MOSS instance.

To place a web part on a page you have to use the SPLimitedWebPartManager which could be retrieved from the actual SPWeb object.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM