Im having problems listing some content under a folder.... I have a template names Frontpage Box, and the alias of the template is FrontpageBox
Im created a razor script file, and a macro for listing the items under the folder... However, I cant get it to list my items...
The script is pretty simple:
<ul>
@foreach (var item in @Model.FrontpageBox.Where("Visible"))
{
<li>Dette er en test<a href="@item.Url">@item.Name</a></li>
}
</ul>
I've tried @Model.FrontpageBoxes also, which doens't work... I've tried outputting something within the foreach, however, it never gets into the foreach... ? What am i doing wrong?
Very simple razor question
Hey guys...
Im having problems listing some content under a folder....
I have a template names Frontpage Box, and the alias of the template is FrontpageBox
Im created a razor script file, and a macro for listing the items under the folder...
However, I cant get it to list my items...
The script is pretty simple:
<ul>
@foreach (var item in @Model.FrontpageBox.Where("Visible"))
{
<li>Dette er en test<a href="@item.Url">@item.Name</a></li>
}
</ul>
I've tried @Model.FrontpageBoxes also, which doens't work... I've tried outputting something within the foreach, however, it never gets into the foreach... ? What am i doing wrong?
By the way, the structure of the site is:
Home
Products
Frontpage Boxes
- Frontpage box1
- Frontpage box2
- Frontpage box3
Hey Nicky
I guess you need to look at which nodes you want to look at. Currently you are only looking at the node you are currently at and nothing else.
You could try:
@foreach (var item in @Model.NodeById(1000).Children.FrontpageBox.Where("Visible"))
@{var nodeCollection = Model.NodeById(Parameter.topNode).Descendants("FrontPageBoxes"); }
<ul>
@foreach(var nodeItem in nodeCollection){
<li>Dette er en test<a href="@nodeItem.Url">@NodeItem.Name</a></li>
}
</ul>
Til example uses a macro parameter (Parameter.topNode). Hope you can use it :)
is working on a reply...