MVC News widget : News detail and News lists on same page

Posted by Community Admin on 05-Aug-2018 06:24

MVC News widget : News detail and News lists on same page

All Replies

Posted by Community Admin on 03-May-2016 00:00

Hi all,

I have created one page for News Details where I have added News widget at 2 placeholders for showing News Detail and News List. When I select any news from home page then it is redirecting to News detail page. On News detail page both the sections News Detail and News list are showing selected news only.

Please help me on this

Posted by Community Admin on 03-May-2016 00:00

Hi,

With webforms this is possible by placing two widgets on the page and changing the ContentViewDisplayMode property in advanced widget settings.
Automatic is the Default but if you change it to Master it will show the list.   

However Feather widgets don not have this property.
As a workaround you can create two new views for the Feather news widget which will be used for showing the News list of the second widget on the details page.

Within ~/MVC/Views/News you create 2 new files, for example: List.NewsListCustom.cshtml and paste:

@model Telerik.Sitefinity.Frontend.Mvc.Models.ContentListViewModel


and Detail.DetailPageCustom.cshtml and paste:

@model Telerik.Sitefinity.Frontend.Mvc.Models.ContentDetailsViewModel
@Html.Action("Index", "News");


Now on your detail page you use the 2 custom views for the "News List" widget.

Please observe following screencast with a small demo:
http://screencast.com/t/7DeGHnE5

There is a Feature Request logged regarding the "Add ContentViewDisplayMode for Feather content widgets", available here:
http://feedback.telerik.com/Project/153/Feedback/Details/186475-add-contentviewdisplaymode-for-feather-content-widgets
 

Regards,
Dimitri Cools
Telerik
 
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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 21-Sep-2016 00:00

This workaround is fine when you have only one View for the news listing. How can you do it when you have several list views and you want to display a specific one?

This command @Html.Action("Index", "News") is calling the default view for News List, is there a way to specify a different view file?

This thread is closed