Get Members where the property (MNTP) contains the id of the page
I added custom properties for the members. One is a Multi-Node -Tree-Picker (memberPages). On a specific page I want to show the members who selected that page on the MNTP.
So here is my code, which works, but I think it can made easier/faster...
@foreach (dynamic m in members) { dynamic pages= new DynamicXml(m.getProperty("memberPages").Value); var showItem = false;
foreach (dynamic d in
pages ) { dynamic node = new DynamicNode(d.InnerText);
If I understand correctly, instead of checking every member to see if they selected the current page, how about wiring up Relations to that MNTP via the MultiPicker Relations (with a reverse index), and then you can do one quick hit to get all members associated to a given page ?
Get Members where the property (MNTP) contains the id of the page
I added custom properties for the members. One is a Multi-Node -Tree-Picker (memberPages). On a specific page I want to show the members who selected that page on the MNTP.
So here is my code, which works, but I think it can made easier/faster...
@foreach (dynamic m in members)
{
dynamic pages= new DynamicXml(m.getProperty("memberPages").Value);
var showItem = false;
foreach (dynamic d in pages )
{
dynamic node = new DynamicNode(d.InnerText);
if (node.Id == Model.Id)
{
showItem = true;
}
}
if (showItem) {
//do something
}
}
Hope someone can help me??
Hi Sanders,
What exactly does the m.getProperty("memberPages").Value give back? Is this actual XML, or a comma-separated list?
Cheers,
Michael.
Hi Michael,
It returns XML like this:
<MultiNodePicker>
<nodeId>1548</nodeId>
<nodeId>1550</nodeId>
</MultiNodePicker>
Thanx!
Hi Sander,
Then I don't see much possibility for improvement. Maybe you can make use of the Where method in Razor to make your code shorter (not tested):
Hope this works/help :-)
Cheers,
Michael.
Hi Sander,
If I understand correctly, instead of checking every member to see if they selected the current page, how about wiring up Relations to that MNTP via the MultiPicker Relations (with a reverse index), and then you can do one quick hit to get all members associated to a given page ?
HTH,
Hendy
Thanks both!
@Michael: This doesn't work...I leave it so for now...
@Hendy: Maybe I use your option in a later stadium!
Ok too bad...
Good luck further :-)
Cheers,
Michael.
is working on a reply...