Style first/newest item different from the other ones
Hi
I'm building a news list and need to style the first item/newest item different from the other ones. The items have all the same doctype.
How do I do that with razor?
I think I should make a for each loop but how to pick out the first item?
Another thing. I have some items with a doctype and only need to show the first item/newest item - right now I have used .Take(1) and a for each loop but there should be a more smarter way to do it - right? :)
Style first/newest item different from the other ones
Hi
I'm building a news list and need to style the first item/newest item different from the other ones. The items have all the same doctype.
How do I do that with razor?
I think I should make a for each loop but how to pick out the first item?
Another thing.
I have some items with a doctype and only need to show the first item/newest item - right now I have used .Take(1) and a for each loop but there should be a more smarter way to do it - right? :)
Hi Michael,
What you could do is if you are making use of NodeById to get your news Items from a particular folder
and to reply to your other question just add .Take(1)
Hope this helps
fuji//
Hi,
To do something different use the .IsFirst() method. This is documented here
To get the first item you simply use .First(), which is documented here.
in general there is a lot of good documentation on the use of dynamic nodes is this part of the documentation.
/Carsten
is working on a reply...