I have a nuPicker with a dropdown list of builders, and its works fine.
However, I want to display all the Siblings with the same builder homes
I've try
@foreach (var builderId in CurrentPage.builder.PickedKeys)
{
<h4>@builderId</h4> //Get the selected builder ID
foreach (var relatedItems in Model.Content.Siblings().Where(x => x.Id != Model.Content.Id && x => x.builderId == builderId).RandomOrder().Take(3))
{
// do some stuff...
}
}
How can I the lambda if they are the same in builderId?
Are you using Models Builder? If so I think your builderIdwill be BuilderId. If not they you need to use GetPropertyValue so your where clause would become:
Successfully getting the nuPicker ID in each homes inside foreach loop.
@ {
// Get the selected nuPicker ID
var BuilderId = CurrentPage.builder.PickedKeys[0];
foreach (var relatedItems in Umbraco.Content(1099).Children)
{
// Get the nuPicker ID in each homes
var relatedItemsid = relatedItems.GetPropertyValue("builder").PickedKeys[0];
}
}
My Problem now is, I want to use the relatedItemsid in Where() or the lambda clause.
How can I use lambda clause?
Hi guys,
I have a nuPicker with a dropdown list of builders, and its works fine.
However, I want to display all the
Siblings
with the samebuilder homes
I've try
}
How can I the lambda if they are the same in
builderId
?I'm using Umbraco v7.
Hi Jin,
Are you using Models Builder? If so I think your
builderId
will beBuilderId
. If not they you need to useGetPropertyValue
so your where clause would become:Just to note as well, that you should only need to do
x =>
once in your where clause, at the start.Hi Ben,
Thank you for response!
But don't have display, the
foreach
statement is not TRUE.Or is there any other ways to implement
related posts
with the same inbuilderId
?I have a limited knowledge in Umbraco.
Hi guys,
Still seeking for help :(
Regards
Jin
Hi Jin,
Can you post your document types please (probably the one you're on now and the one with the picker)?
Hi Ben,
Thanks for your fast response, I'm really new in Umbraco.
Here's the structure of my project.
The nuPicker
nuPicker Data
Regards,
Jin
Thanks Jin,
Look like your property alias id should be
builder
, notbuilderId
. Try the following:Hi Ben,
No display again! Maybe the output of
is JSON
And the
foreach statement
is...GetPropertyValue<string>("builder") == builderId
and thebuilderId
is an INT ?Regards,
Jin
Hi Ben,
What I've done now is;
Successfully getting the nuPicker ID in each homes inside
foreach loop
.My Problem now is, I want to use the
relatedItemsid
in Where() or the lambda clause.Any help for this.
Thanks in advance,
Jin
is working on a reply...