Can't Set External Layout Template for News Widget Detai

Posted by Community Admin on 04-Aug-2018 21:49

Can't Set External Layout Template for News Widget Detail View

All Replies

Posted by Community Admin on 31-Aug-2011 00:00

I was successful in creating an external layout template for the news widget for list view following these directions.  However, when I try to repeat the steps for the Detail View it does not work.  In fact a few things happen.  Just setting an external layout for the list view completely blasts the detail view.  So, if I drag a news widget in, do nothing (just use default layouts), news will list, and when I click on it I get details.  If I drag a news widget, only set the list view external layout template, the list view will work, but when you click a news item the page is blank and no details are shown.

One observation I made was that the TemplateKey for the details view always reappears.  Even after I clear it and save, if I go back to edit the widget it reappears.

Am I missing something?  It seems there was a bug at some point noted here but that was for the list view rather than detail view.  I'm not sure if it's related.  I can't find a single mention of a detail view layout template despite seeing the option in the news widget advanced settings.  Thanks for any help.

Sitefinity Version 4.2 1650

Posted by Community Admin on 31-Aug-2011 00:00

After trying a few things I'm assuming this is a bug w/ the NewsView Designer.  I don't know if we're supposed to post to the PITS ourselves?  I'll wait for a response.  I'm able to create a NewsView programmatically and set the external layouts with the code below.  A temporary workaround, but eventually I will need my users to be able to set this within the backend.

Telerik.Sitefinity.Modules.News.Web.UI.NewsView nvRecentPosts = new Telerik.Sitefinity.Modules.News.Web.UI.NewsView();
 
nvRecentPosts.ControlDefinition.GetDefaultMasterView().TemplateKey = "";
nvRecentPosts.ControlDefinition.GetDefaultMasterView().TemplatePath = "~/App_WidgetTemplates/ContentNewsList.ascx";
 
nvRecentPosts.ControlDefinition.GetDefaultDetailView().TemplateKey = "";
nvRecentPosts.ControlDefinition.GetDefaultDetailView().TemplatePath = "~/App_WidgetTemplates/ContentNewsDetail.ascx";
 
phRecentPosts.Controls.Add(nvRecentPosts);

Posted by Community Admin on 03-Sep-2011 00:00

My eyes are officially broken.  I made a typo in my layoutpath in the designer but not in the code above which is why it didn't load ugh...  For what it's worth to anyone else despite always seeing a value in the TemplateKey for the details view it would still load my external file.

I think you guys need a "delete embarrassing thread" button...

This thread is closed