Site structure
Version 3.x > Site structure > How can I add webpart by code? View modes: 
User avatar
Member
Member
shinobi368@yahoo.com - 1/30/2009 1:03:53 AM
   
How can I add webpart by code?
I have read the developer guide but I haven't read about how to add the webpart dynamically (by code) to the portal. Could you show me how, please? For example, how can I type the code if I want to add my own web part to my portal? Thank you very much.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/30/2009 6:24:47 AM
   
RE:How can I add webpart by code?
Hi,

You need to create another custom web part or control and the function of this one will be the dynamic adding of the web part you want to add to the page. I hope it makes sense.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
shinobi368-yahoo - 1/30/2009 4:44:13 PM
   
RE:How can I add webpart by code?
Hi,

I don't understand it much. So you said that I need to create a web part, right? Then this web part will be responsible to add another webpart. But how can I implement it. What type of code or APIs I need to use? Thank you very much and I really appreciate your effort.


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/2/2009 8:44:46 AM
   
RE:How can I add webpart by code?
Hi,

You want to allow only some users to be able to see the Design tab and add web parts? You need to grant them with sufficient permissions - by default there is a user role named Designers for this. But of course, you can modify the permissions. you can find more information in our documentation:

http://devnet.kentico.com/docs/tutorial/index.html
http://www.kentico.com/docs/devguide/authorization_permissions.htm
E-commerce guide:
http://www.kentico.com/docs/ecommerceguide/index.html

Best Regards,
Juraj Ondrus