Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Developing custom controls/web parts in a separate solution View modes: 
User avatar
Member
Member
main-it - 3/5/2009 4:15:52 AM
   
Developing custom controls/web parts in a separate solution
Hi everyone,
I read a lot of documentation about developing web parts and/or custom web controls to be used into the portal engine. The development process starts from opening the existing WebProject.sln in the deploy directory.

I have a question. Is it possibile to start with a new blank solution to create an external web controls library and once compiled "attach" the library to the portal engine? I understand that I need to add references to Kentico CMS controls and I read about a call to an API to initizialize the environment. But once I developed my library and I compiled it, how can I integrate it to the portal engine?

Let me explain the reason why I need this feature. I'm going to develope a new project based on Kentico 4.0. Some "web parts" will be developed from other developers. I don't want to share the VS Solution and/or implement Team Foundation solution and/or implement kentico web farm support. I think that an easy alternative shoud be allowing other developers to develope their own controls/library in a separate assembly. Well, all that should work if I have a way to integrate/configure those libraries into the portal engine ...

Many thanks for any answer.
MRK

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 3/10/2009 3:26:32 AM
   
RE:Developing custom controls/web parts in a separate solution
Hello,

I would suggest the following. Every developer would install a new instance of Kentico and develop a web part. Every web part can be exported and imported in the final solution.

I hope this is an acceptable solution for you.

Best Regards,
Boris Pocatko

User avatar
Member
Member
main-it - 3/10/2009 3:46:05 AM
   
RE:Developing custom controls/web parts in a separate solution
Hi Boris,
thank you for your interest with my case.

I'm going to try different solutions to better manage this scenario. Of course, I will keep in mind your suggestion and I will try it.

Thank you,
MRK

User avatar
Member
Member
main-it - 3/12/2009 9:18:02 AM
   
RE:Developing custom controls/web parts in a separate solution
Hi Boris,
here I am with some news about my initial post. Finally I was able to obtain the desired solution. I'm going to write the main steps I used to start developing such a solution.

1. Create a new Visual Studio Project (ASP.NET Web Application);
2. Add references to CMS.*.dll bins (or those DLL you will need in your project);
3. Remove default pages (I don't need them);
4. Add a global.asax file and edit the code behind adding a call to CMS.CMSHelper.CMSContext.Init() and to CMS.VirtualPathHelper.VirtualPathHelper.RegisterVirtualPathProvider() in Application_Start method (I'm going to verify if I really need that).
5. Now add a new web control (mycontrol.ascx) and write the required code. For example I simply added a DataGridView object, binded it to an external datasource. Also, in the Page_Load event, I added standard Kentico code to check user authentication and permissions.
6. Compile it.

At this point I simply copied MyProject.dll to the /bin folder in the Kentico site. The I took the control (mycontrol.ascx) and placed it in a subfolder inside the Kentico site. Finally I started CMS Site Manager and I created a new WebPart linked to my control.

Now, starting CMSDesk, I'm able to use the control within my site and the control behaves as expected.

I need to make some more test but this first result is very interesting and it opens new ways to collaborate with external developers.

The reasoning behind this approach is the same described by Kentico in integrating third party controls with some additionals steps to be able to make calls to Kentico APIs.

Kind regards,
MRK

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 3/12/2009 10:10:50 AM
   
RE:Developing custom controls/web parts in a separate solution
Hello,

Thank you very much for sharing. It will help other users if they are trying something similar.

Good luck with the development.

Have a nice day.

Best Regards,
Boris Pocatko