views:

43

answers:

2

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.

+1  A: 

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.

Flo