Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Adding a webpart programmatically View modes: 
User avatar
Certified Developer v6
Certified Developer v6
cjennings-wakefly - 2/11/2011 10:59:56 AM
   
Adding a webpart programmatically
Is it possible to add a new webpart to the CMS via the API? I am not talking about adding a webpart to a page, but rather adding a new webpart to the CMS that isn't defined yet at all.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 2/15/2011 4:32:37 PM
   
RE:Adding a webpart programmatically
Hi,

Sure, it's possible using our API, mostly by creating new instance of WebPartInfo and using WebPartInfoProvider methods to save that new webpart.

Comprehensive illustration of the API usage can be found in code of controls for adding webparts in Site manager. They are located in:

~\CMSModules\PortalEngine\UI\WebParts\Development\WebPart_New.aspx.cs
and related codefiles.

Hope this will help.

Regards,
Zdenek