Layout Template a User Control
There is a way to template a User Control (not a Custom Control).
The thing is we have a bunch of standard .NET user controls and want to register them in the toolbox and be able to change the LayoutTemplate using Sitefinity. Is this possible ?
Thanks in advance for any thought on this.
Do you just mean this?
<add tagName="MenuSearchBar" tagPrefix="ocfp" src="~/UserControls/Menu/MenuSearchBar.ascx" /><add enabled="True" type="~/UserControls/CME/OnTheRoadCalendar/OnTheRoadCalendar.ascx" title="OnTheRoadCalendar" description="OnTheRoadCalendar" cssClass="ontheroadIcon" layoutTemplate="~/UserControls/CME/OnTheRoadCalendar/OnTheRoadCalendar.ascx" visibilityMode="None" name="OnTheRoadCalendar" />
Thanks Steve,,
Is more complicated than that ... Actually I want to take advantage of some Sitefinity template replacement (engine, core) etc but without having to use Custom Controls... I far as know custom controls inherit from ViewBase, ContentView etc.
But "user controls" are simple plain asp net web user controls.
Can I use template replacement mechanism on out of the box web user controls...? Need to implement some interface for example ITemplate ?
With template replacement mechanism I mean be able to change a widget template using the LayoutTemplateName , Virtual Paths ,config .. or whatever.
Thanks again..
Hello Ronnie,
I understand what you need, but I don't think this would be possible. In .ascx controls the view and the code-behind are dependent on each-other, which means that you cannot separate them without making the control a custom one (inheriting from ViewBase), which would separate view and "viewmodel".
All the best,
Thanks a lot, that's what I thought...
Hi Ronnie,
Glad that we cleared this out. Let me know if you have any other questions.
Regards,