Layout Template a User Control

Posted by Community Admin on 04-Aug-2018 22:01

Layout Template a User Control

All Replies

Posted by Community Admin on 18-Nov-2011 00:00


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.

Posted by Community Admin on 20-Nov-2011 00:00

Do you just mean this?

<add tagName="MenuSearchBar" tagPrefix="ocfp" src="~/UserControls/Menu/MenuSearchBar.ascx" />

If you add it to the web.config with the above line then you can use it in your .master file.

...or you can register it in the backend Settings->Toolbox like this
<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" />
...and then it allows you to drag and drop it onto a page dynamically in the page editor :)

If I've got your question wrong, please let me know :)

Posted by Community Admin on 21-Nov-2011 00:00


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..

Posted by Community Admin on 24-Nov-2011 00:00

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,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 29-Nov-2011 00:00


Thanks a lot, that's what I thought...

Posted by Community Admin on 30-Nov-2011 00:00

Hi Ronnie,

 Glad that we cleared this out. Let me know if you have any other questions.

Regards,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed