IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
By default custom templates for widgets are not visible and cannot be edited in Design -> Widget templates. If you customized the Download list widget templates, as described in Customize Download list widget templates, the following article will guide you how to make your templates editable through the UI.
protected
void
Application_Start(
object
sender, EventArgs e)
{
SystemManager.ApplicationStart += SystemManager_ApplicationStart;
}
SystemManager_ApplicationStart(
ControlTemplates.RegisterTemplatableControl(
typeof
(CustomDownloadListWidget),
(
));
RegisterTemplate();
public
RegisterTemplate()
var initializer = SiteInitializer.GetInitializer();
var manager = initializer.PageManager;
var existingTemplate = manager.GetPresentationItems<ControlPresentation>().Where(p =>
p.EmbeddedTemplateName ==
"SitefinityWebApp.CustomControls.CustomDownloadListWidget.ascx"
&&
p.ControlType ==
(CustomDownloadListWidget).FullName &&
p.Name ==
"CustomWidgetTemplate"
)
.SingleOrDefault();
if
(existingTemplate ==
null
initializer.RegisterControlTemplate(
,
(CustomDownloadListWidget).FullName,
"Documents & Files"
"ASP_NET_TEMPLATE"
(CustomDownloadListWidget).Assembly.FullName,
"Documents - list"
);
initializer.SaveChanges();
class
CustomDownloadListWidget : DownloadListView
override
LoadView(
string
viewName)
(viewName == DocumentsDefinitions.FrontendMasterListViewName)
this
.LayoutTemplatePath =
"~/CustomPrefix/"
+
.GetTemplate();
else
(viewName == DocumentsDefinitions.FrontendMasterTableViewName)
"your template path goes here ..."
;
base
.LoadView(viewName);
private
GetTemplate()
PageManager pageManager = PageManager.GetManager();
var widgetTemplate = pageManager.GetPresentationItems<ControlPresentation>()
.FirstOrDefault(p => p.DataType == Presentation.AspNetTemplate &&
p.AreaName ==
(widgetTemplate !=
return
widgetTemplate.EmbeddedTemplateName;
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important