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
hi everyone
I want to use .OrderBy("CreateDate desc").Take(int) after the call of my data ,
for example :
<h5 class="toto"><a href="#">@child.alias.OrderBy("CreateDate desc").Take(1)</a></h5>
but it s not work , how can i do dthat
i need your help
thank you so mush
Hi khansaa111,
You will need to add the .OrderBy("CreateDate desc").Take(int) where you are loop through the elements, so it could look something like this,
@foraech(var child in CurrrentPage.Children.Where("Visible").OrderBy("CreateDate desc").Take(5)){ }
Hope this helps,
/Dennis
hi Deninis ,
thank you for your answer
well, I know that i have to use the syntax .OrderBy("CreateDate desc").Take(int) im loop : it's mean into the foreach ,
but i have a problem !
explication :) :
I have 3 level My Content , I work in the homepage , & I want to show the children of the children of my homepage , but on condition !
show just the latest children whose type is " Transport "
"Transport" : " is a choice among the choices of a dropdown .
well , this is my code page
@inherits UmbracoTemplatePage@{ var Portal_home = CurrentPage.AncestorsOrSelf(1).First(); var mylevel1 = Portal_home.Children.Where("UmbracoNaviHide == true");}<section class="col-actualite"><div style="border:1px solid red;" class="pavet_video"> @foreach (var mylevel2 in mylevel1) { foreach (dynamic mylevel3 in mylevel2.Children.Where("Visible")) { if (mylevel3.letype == "Transport") {
<!-- Dennis : I need to add the .OrderBy("CreateDate desc").Take(int) there , after if not before --> <h5 class="h5-title-actu"><a href="#">@mylevel3.letype</a></h5> <h5 class="h5-title-video"><a href="#">@mylevel3.titreAlaUne</a></h5> } } } </div>
</section
I was thinking if you could do it like this instead and then get the right data.
@foreach (var mylevel2 in mylevel1) { foreach (dynamic mylevel3 in mylevel2.Children.Where("Visible && DocumentTypeAlias == @0", "Transport").OrderBy("CreateDate desc").Take(5)) { <h5 class="h5-title-actu"><a href="#">@mylevel3.letype</a></h5> <h5 class="h5-title-video"><a href="#">@mylevel3.titreAlaUne</a></h5> } }
Dennis
Hi Dennis
I agree with you but :)
i dont want to filter by DocumentTypeAlias , but by using mylevel3.letype , this img well show you all
Okay the screenshot is very nice. Then I think you could do it like this.
@foreach (var mylevel2 in mylevel1) { foreach (dynamic mylevel3 in mylevel2.Children.Where("Visible && letype == \"Transport\"".OrderBy("CreateDate desc").Take(5)){ <h5 class="h5-title-actu"><a href="#">@mylevel3.letype</a></h5> <h5 class="h5-title-video"><a href="#">@mylevel3.titreAlaUne</a></h5> } }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
use .OrderBy("CreateDate desc").Take(int)
hi everyone
I want to use .OrderBy("CreateDate desc").Take(int) after the call of my data ,
for example :
<h5 class="toto"><a href="#">@child.alias.OrderBy("CreateDate desc").Take(1)</a></h5>
but it s not work , how can i do dthat
i need your help
thank you so mush
Hi khansaa111,
You will need to add the .OrderBy("CreateDate desc").Take(int) where you are loop through the elements, so it could look something like this,
Hope this helps,
/Dennis
hi Deninis ,
thank you for your answer
well, I know that i have to use the syntax .OrderBy("CreateDate desc").Take(int) im loop : it's mean into the foreach ,
but i have a problem !
explication :) :
I have 3 level My Content , I work in the homepage , & I want to show the children of the children of my homepage , but on condition !
show just the latest children whose type is " Transport "
"Transport" : " is a choice among the choices of a dropdown .
well , this is my code page
@inherits UmbracoTemplatePage
@{
var Portal_home = CurrentPage.AncestorsOrSelf(1).First();
var mylevel1 = Portal_home.Children.Where("UmbracoNaviHide == true");
}
<section class="col-actualite">
<div style="border:1px solid red;" class="pavet_video">
@foreach (var mylevel2 in mylevel1)
{
foreach (dynamic mylevel3 in mylevel2.Children.Where("Visible"))
{
if (mylevel3.letype == "Transport")
{
<!-- Dennis : I need to add the .OrderBy("CreateDate desc").Take(int) there , after if not before -->
<h5 class="h5-title-actu"><a href="#">@mylevel3.letype</a></h5>
<h5 class="h5-title-video"><a href="#">@mylevel3.titreAlaUne</a></h5>
}
}
}
</div>
</section
Hi khansaa111,
I was thinking if you could do it like this instead and then get the right data.
Hope this helps,
Hope this helps,
Dennis
Hi Dennis
I agree with you but :)
i dont want to filter by DocumentTypeAlias , but by using mylevel3.letype , this img well show you all
Hi khansaa111,
Okay the screenshot is very nice. Then I think you could do it like this.
Hope this helps,
/Dennis
is working on a reply...