Our monthly Virtual Happy Hour is happening this week, Fri Feb 23!
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!
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.
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.
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.