News Master-Detail latest news as default detail

Posted by Community Admin on 03-Aug-2018 05:20

News Master-Detail latest news as default detail

All Replies

Posted by Community Admin on 03-Jun-2013 00:00

Hi,

Am using master detail view for my news module. I want the latest news item to be displayed as default detail. Can anyone help me?

Posted by Community Admin on 03-Jun-2013 00:00

Hi shahna,

You could do 2 things:

1. Add a separate NewsView on your page that you configure to run in Detail mode. Under this NewsView you add another NewsView that renders in List mode.

You can change the render mode in the Advanced properties of the NewsView Designer. It is called: ContentViewDisplayMode. The options to fill in are either 'Automatic', 'Master' or 'Detail'.

2. Adjust the NewsView template to achieve your goal.
You could create a separate template for showing a list of NewsItems where you have another format for the first item in the list. (I've done this on this website: http://knstr.it/19BiAmM)

In the ItemDataBound property of this template I check what the actual index is of the NewsItem being rendered. If it is 0 (the first one), I show or hide a panel.

If you like more information, than let me know.

Kind regards,
Daniel

Posted by Community Admin on 03-Jun-2013 00:00

Hi Daniel

Thanks for your reply. But its not what i actually want. I have already listed my news in Master-Detail mode. when i click on my master news i could see the news in the details mode. but i need the latest news to be displayed in the detail view  when page loads itself. Now my detail news item is empty in the page load. Is there any way to achieve this functionality?

Posted by Community Admin on 03-Jun-2013 00:00

Hi shahna,

I'm not sure if I understand. Do you have an example or screenshot?

If you want to have the latest NewsItem to always show whether you load the MasterView or DetailView, I think you will end up with a separate NewsView widget, that is filtered to show only one NewsItem and is set to render in DetailView.

Kind regards,
Daniel

Posted by Community Admin on 03-Jun-2013 00:00

Hi Daniel

Please find the attached screen shots.

Posted by Community Admin on 03-Jun-2013 00:00

Hi shahna,

I don't think this can be done out-of-the-box.
I did the following:

  • Created a News page
  • Placed one News widget on the page that is set to render in Master mode
  • Place another News widget on the page that is set to always show 1 item and I've chosen to use the template that also renders the full content.

Now when you load the page, you will have the list with News items shown in the first widget and you'll see the latest newsitem inside the second widget.
If you click on a newsitem in the first widget, the second widget will render that content. That is what you want, but the list of newsitems in the first widget will be gone.

Unless someone else knows how to do this out-of-the-box, I myself would probably create a simple usercontrol that lists an amount of NewsItems and generate the url myself, so that the list would always be there.

Kind regards,
Daniel

Posted by Community Admin on 03-Jun-2013 00:00

Hi shahna,

I don't think this can be done out-of-the-box.
I did the following:

- Created a News page
- Placed one News widget on the page that is set to render in Master mode
- Placed another News widget on the page that is set to always show 1 item and I've chosen to use the template that also renders the full content.

Now when you load the page, you will have the list with News items shown in the first widget and you'll see the latest newsitem inside the second widget.
If you click on a newsitem in the first widget, the second widget will render that content. That is what you want, but the list of newsitems in the first widget will be gone.

Unless someone else knows how to do this out-of-the-box, I myself would probably create a simple usercontrol that lists an amount of NewsItems and generate the url myself, so that the list would always be there.

Kind regards,
Daniel


Posted by Community Admin on 03-Jun-2013 00:00

Hi Daniel,

Thanks for the reply. Am new to sitefinity so i didnt completely get your answer. Could you please be more specific?

Posted by Community Admin on 03-Jun-2013 00:00

Hi shahna,

What I mean is that you probably end up creating your own widget to show a list of NewsItems. So you'll have to create a UserControl and use the Sitefinity API's to get your newsitems. As said, maybe there is a way to do it out-of-the-box, but I'm not aware of it regarding this specific situation.

Kind regards,
Daniel

* If this post was helpful, please mark it as answered *

This thread is closed