November Happy Hour will be moved to Thursday December 5th.

What is the most elegant way to make existing controls available in Composer?

Vote:
 

I am new to composer and was wondering what the best practice is. 

I already have a bunch of user controls in my templates/units folder (but could just as easily be using server controls). I want to use some of these with composer. Following the composer tutorials tells me I have to inherit from Dropit.Extension.Core.BaseContentFunction rather than EPiServer.UserControlBase for a composer function.

For example, if I have an RSS control, sometimes i may want to use it right in my page templates and have the user set RssUrl via a page property, sometimes I may want the function added via Composer and the RssUrl added there.

Is the best approach to write Composer .ascx wrappers for all of my controls and just make sure that all of the controls I am wrapping have settings exposed as public properties? Is there a more elegant way of doing this?

Thanks for your help!

#37836
Mar 22, 2010 14:08
Vote:
 

Dear Joel.

Differ from a Composer page that allows you can either inherit from EPiServer.TemplateBase or Dropit.Extension.Core.ExtensionBaseTemplate and implement Dropit.Extension.Core.ExtensionPageHandler, the Composer function always needs to inherit from Dropit.Extension.Core.BaseContentFunction to make it work correctly and Composer accepts only the usercontrol that inherites from BaseContentFunction to be registrered as Composer function in the admin-mode. 

Right now, I think the only way to make a usercontrol works in both a EPiServer page and as a Composer function is the a wrapper solution as you mentioned.

Regards.

Hieu Doan.

#37913
Mar 24, 2010 3:27
Vote:
 

Hi Joel,

We are in the same situation of exploring options on how to do this. We've come to the same conclution.
You might want to take a look at this project: http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx

It's a nice helper that takes care of the viewstate of dynamically loaded controls.

Regards,
Morten

#37916
Mar 24, 2010 8:38
Vote:
 

Thanks for your pointers guys. I was wondering how to tackle any potential viewstate issues and hopefully the DynamicControlsPlaceholder will help.

By the way, Hieu, your composer developer article is a very useful reference.

#37940
Mar 24, 2010 12:46
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.