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
I am trying to list employees who work in a specific department. An employee can be in more than one department.
I have used nuPickers to add a checkbox property to my Employee Document Type, so that I can select witch departments the person works in.
If I render out an employee, the values for the departments the person works in are page id's of the relevant departments (ex. "1045,1056,1061...").
My code looks like this
@{ var selection = Model.Content.Site().FirstChild("ansatte").Children("ansat") .Where(x => x.IsVisible()); } <ul> @foreach(var item in selection){ <li> <a href="@item.Url">@item.Name</a> </li> } </ul>
I need to add something like:
.Where(x => x.IsVisible() && ansatAfdeling = 1045);
But am not getting it to work... Any suggestions?
If you add this to your where it should work (although not the most elegant solution):
@{ var selection = Model.Content.Site().FirstChild("ansatte").Children("ansat").Where(x => x.IsVisible() && x.GetPropertyValue<string>("departments").Split(',').Contains(1234)); }
I get the following error:
Compiler Error Message: CS1593: Delegate 'System.Func
Code looks like this:
@{ var selection = Model.Content.Site().FirstChild("ansatte").Children("ansat") .Where(x => x.IsVisible() && x.GetPropertyValue<string>("ansatAfdeling").Split(',').Contains(1030)); } <ul> @foreach(var item in selection){ <li> <a href="@item.Url">@item.Name</a> </li> } </ul>
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
List pages that have specific page id in property value
I am trying to list employees who work in a specific department. An employee can be in more than one department.
I have used nuPickers to add a checkbox property to my Employee Document Type, so that I can select witch departments the person works in.
If I render out an employee, the values for the departments the person works in are page id's of the relevant departments (ex. "1045,1056,1061...").
My code looks like this
I need to add something like:
But am not getting it to work... Any suggestions?
If you add this to your where it should work (although not the most elegant solution):
I get the following error:
Compiler Error Message: CS1593: Delegate 'System.Func
Code looks like this:
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.