Standard Web User Controls and Sitefinity

Posted by Community Admin on 03-Aug-2018 16:54

Standard Web User Controls and Sitefinity

All Replies

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

Hi guys,
We are on a POC phase working with Sitefinity and Web User Controls.  Management's goal is to have a single set of Web User Controls (Compiled Widgets) that can be used on both Sitefinity CMS and on a standard ASP.Net app (a non-sitefinity web app).  Mainly reason is minimize the UI code duplication and, by consequent, development effort. 

However, I just concern about what Pure Sitefinity  functionality could I dropping following this approach, so far my web user controls inherit from ASP.Net BASE System.Web.UI.UserControl class but not from Telerik.Sitefinity.Web.UI.SimpleView class for instance, since our ASP.Net web app has no reference to Sitefinity Dlls.  For instance, I'm under impression that "Widgets Templates" doesn't work for System.Web.UI.UserControl controls... if that correct. what else?

Actually, I'm not sure if this approach (a single version for both Sitefinity and non-sitefinity ASP.Net web app) is the right path.  I'm concern on end up with a nightmare because we would not able to get the best from both worlds and have to accept that we have a functional but limited web user controls version, you know... "Hey, let's do this great new feature in our web users controls this guys of sitefinity just released... ooh.. no we can't because it wouldn't work in a standard non-sitefinity web app, or viceversa..."

I'm really open to hear your thoughts... 



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

As strategy we will implement a MVP (Model-View-Presenter) Pattern and have a set of User Controls for Sitefinty as well as a set of Standard Non-Sitefinity User Controls implementing the View Contract.  Both Presenter and Model layer will be reused in both solutions.

That way we will be able to take advance of all Sitefinity benefits and minimize the code duplication... 

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

Hello Carlos Redondo,

 You can use standard asp user controls (.ascx) with Sitefinity and they would work just like in a standard ASP application. Here you can see how to register the controls inside Sitefinity:
http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-controls-adding-controls-to-the-toolbox.html
Of course, in some cases you will have to adjust some details so that they do not interfere with Sitefinity's way of work. 
Creating the same user controls for a Sitefinity and a non-Sitefinity ASP application is not the best practice, but usually you wouldn't encounter any problems reusing standard .ascx controls in Sitefinity.
Considering the MVP pattern - I am not sure if this would work great with Sitefinity. Sitefinity works with a similar to MVVM pattern and has its own routing implemented. You may get the MVP model to work, but this way you wouldn't be utilizing any of Sitefinity's built in features. What's more, how do you plan on having same models for the two applications?

Kind 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