Hide/Show Contents (Like news)

Posted by Community Admin on 03-Aug-2018 13:27

Hide/Show Contents (Like news)

All Replies

Posted by Community Admin on 15-Jul-2011 00:00

Hi!

What If I want to hide/show some contents, like I have news list but I want to show only some of them? I used Fluent API and tried to achieve this functionality by unpublished news item but got nothing.

Would anyone like to tell me?


Thanks in advance!

Posted by Community Admin on 15-Jul-2011 00:00

Hi Waqar,

Actually, unpublished items will not show in the News widget, can you please elaborate on the API implementation that you have used to unpublish the items? I'd kindly ask you to try unpublishing an item from Sitefinity backend and check if it will appear on the frontend page where you have News widget.

Kind regards,
Boyan Barnev
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 16-Jul-2011 00:00

Thanks for the reply!

Actually I am not using sitefinity news widget, I am using Fluent API in custom control for retrieving news items. Can you give me the code that only shows published items?

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

Hi Waqar,

You can filter by ContentLifeCycleStatus.Live. Please take a look at the below code sample:

var newsSelection = App.WorkWith()
                                            .NewsItems()
                                            .Where(nI => nI.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
                                            .Get()
                                            .ToList();



Kind regards,
Boyan Barnev
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 18-Jul-2011 00:00

I wrote this code but it showing all news items published and unublished.

Any idea?

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

Hi Waqar,

I'm sorry for misleading you, it looks like I've missed to add a filter for the ones that have Visible set to false. Please try using the below code sample, it should return only published items.

var newsSelection = App.WorkWith()
                    .NewsItems()
                  .Where(nI => nI.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && nI.Visible == true)
                   .Get()
                  .ToList();



All the best,
Boyan Barnev
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