Hi, I have document type Deal having multinode treepicker named device that is picking nodes with type Device. The Device nodes all have Id that's the umbraco Id.
Now I have integer value "did". I need to select all the Deals that have once selected in the multinode treepicker the node with the Id equals to did.
selection = selection.Where(x => (((Deal)x).Device != null) && ...); //The problem is the code where the ... are.
If I understand your question correctly. You want to get all "selections" where the Id matches "did"?selection = selection.Where(x => ((Deal)x).Device != null && x.Id == did
The above should be your answer if you are using the Multinode.Treepicker. But if you are using the Multinode.Treepicker2 you need to convert the Udi to an Id first.
No Joep, this was not my question. did is the Id of a Device. selection is a List of Deal. 1 selection can have multiple devices.
If it was content picker it would have been
selection = selection.Where(x => ((Deal)x).Device != null && (Device)((Deal)x).Device.Id== did)) and this works with content picker. But in this case I have multinode treepicker. And yes it is a Multinode.Treepicker2
multinode treepicker in linq
Hi, I have document type Deal having multinode treepicker named device that is picking nodes with type Device. The Device nodes all have Id that's the umbraco Id.
Now I have integer value "did". I need to select all the Deals that have once selected in the multinode treepicker the node with the Id equals to did.
Please advice what do I put in the ...
any updates on my problem?
If I understand your question correctly. You want to get all "selections" where the Id matches "did"?
selection = selection.Where(x => ((Deal)x).Device != null && x.Id == did
The above should be your answer if you are using the Multinode.Treepicker. But if you are using the Multinode.Treepicker2 you need to convert the Udi to an Id first.
No Joep, this was not my question. did is the Id of a Device. selection is a List of Deal. 1 selection can have multiple devices.
If it was content picker it would have been
selection = selection.Where(x => ((Deal)x).Device != null && (Device)((Deal)x).Device.Id== did))
and this works with content picker. But in this case I have multinode treepicker. And yes it is a Multinode.Treepicker2So something like this?
selection = selection.Where(x => ((Deal)x).Device != null && x.Device.Any(d => d.Id == did)
is working on a reply...