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, I have the following code.
@{
var selection = CurrentPage.Site().Children.Where("Visible");
}
I want to do something like
var numPage = count(selection);
But umbraco does not like this. What else do I need for the above?
Hi Takashi
You should be able to simply do
@{ var selection = CurrentPage.Site().Children.Where("Visible"); selection.Count(); }
Does this work?
/Jan
That works great! Thanks Jan.
You're welcome - You might benefit from having this cheatsheet open when you do razor in Umbraco btw :) https://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets
Happy coding.
Thanks, Jan. That's a great cheat sheet!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to use count() function.
Hi, I have the following code.
@{
var selection = CurrentPage.Site().Children.Where("Visible");
}
I want to do something like
var numPage = count(selection);
But umbraco does not like this. What else do I need for the above?
Hi Takashi
You should be able to simply do
@{ var selection = CurrentPage.Site().Children.Where("Visible"); selection.Count(); }
Does this work?
/Jan
That works great! Thanks Jan.
Hi Takashi
You're welcome - You might benefit from having this cheatsheet open when you do razor in Umbraco btw :) https://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets
Happy coding.
/Jan
Thanks, Jan. That's a great cheat sheet!
is working on a reply...