Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello everybodyHow do I get this script only showing the first found child data? Is it wrong to use foreach?
@foreach (var page in @Model.Children.Where("Visible")){<div class="tab-pane fade in active" id="@page.id"> <div class="span8 offset2"><h1 class="post_intro center">@page.header</h1> <div class="pad30"></div> <div class="post"> <img src="@page.image" alt="" > <div class="pad30"></div> <p>@page.description</p> <h4 class="grey2"><i class="icon-quote-left icon-3x pull-left colour marg-left5"></i>@page.descriptionQuote</h4> <div class="pad25"></div> </div> </div></div>}
Thanks in advance!//René
Hi Rene,
Instead of making of a foreach you could just make a check to see if Model has Child node and if so display first child only.
@if(Model.Children.Where("Visible").Count() > 0){ @Model.Children.First().Name}
Hope this helps
//fuji
Hi Fuji,Thank you for the quick reply on all my posts today. This solved my problem. :-)I will get back to you when I have solved the problem on the other post:http://our.umbraco.org/forum/developers/razor/41296-Active-tab-problem//René
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Only show the first found child data
Hello everybody
How do I get this script only showing the first found child data? Is it wrong to use foreach?
Thanks in advance!
//René
Hi Rene,
Instead of making of a foreach you could just make a check to see if Model has Child node and if so display first child only.
Hope this helps
//fuji
Hi Fuji,
Thank you for the quick reply on all my posts today.
This solved my problem. :-)
I will get back to you when I have solved the problem on the other post:
http://our.umbraco.org/forum/developers/razor/41296-Active-tab-problem
//René
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.