I am realy stuck with this for days... I am trying to get a list of members with their Multinode tree picker values.
This is my code:
var member = Services.MemberService.GetAllMembers();
@foreach (var item in member)
{
var typedMultiNodeTreePicker = Model.Value<IEnumerable<IPublishedContent>>("categoryPicker");
foreach (var category in typedMultiNodeTreePicker)
{
<p>@category.Name</p>
}
<p>@item.Email</p>
}
var typedMultiNodeTreePicker = item.GetProperty<IEnumerable<IPublishedContent>>("categoryPicker");
Since we want to the members property we have to use "item". Since Model is "Currentpage" and the "Currentpage" dosen't have the property value "categoryPicker"
Okay, so it looks like PropertyValueConverters don't kick in on Members.
The MultiNodeTreePicker is storing the selection as a string of UDI's separated by a comma.
So you'll have to split the string on the comma and then loop around each entry and then retrieve the IPublishedContent for the categories you are trying to retrieve.
I think "something" like this but there will be errors in my code
var categoriesString = item.GetValue<string>("categoryPicker");
foreach(var categoryString in categoriesString.Split(','))
{
var category = Umbraco.Content(categoryString);
}
Additional Info - Untested
I think part of the issue is how you are getting the Members, if you were getting individual Members using the MembershipHelper they come back as IPublishedContent entries, in which case I suspect the PropertyValueConverters would kick in and what you were trying would work.
Cant get members MNTP values
I am realy stuck with this for days... I am trying to get a list of members with their Multinode tree picker values. This is my code:
But i am getting this error:
Hi Silvija!
Is it the member that has the Multinode treepicker? in that case
Try changing :
To:
Let me know if it works!
//Johannes
Hi Johannes,
Yes, its MNTP member custom property. When I try your suggestion i am getting this compilation error:
I belive it should be
Since we want to the members property we have to use "item". Since Model is "Currentpage" and the "Currentpage" dosen't have the property value "categoryPicker"
//Johannes
I tried that too but i am getting this message:
Probably i am missing namespace , but i dont know which one. This is what i have now:
@using ContentModels = Umbraco.Web.PublishedModels;
Not to sure on Umbraco 8, but 7 is
//Johannes
Unfortunately its still the same :/
I have done some testing of this myself, I the closest that I have gotten it this.
But this returns null, but maybe it will work for you?
Otherwise I am unfortunately out of idéa :(
//Johannes
When I try it that way i am getting this:
It says:
Severity Code Description Project File Line Suppression State Error CS1929 'IEnumerable
I alredy tried this before but with no luck.
Still thank you Johannes for the effort.
Silvija
I'm still struggling with this. This is the closest I came to:
Anybody else have any idea? I really got stuck. Thanks
Okay, so it looks like PropertyValueConverters don't kick in on Members.
The MultiNodeTreePicker is storing the selection as a string of UDI's separated by a comma.
So you'll have to split the string on the comma and then loop around each entry and then retrieve the IPublishedContent for the categories you are trying to retrieve.
I think "something" like this but there will be errors in my code
Additional Info - Untested
I think part of the issue is how you are getting the Members, if you were getting individual Members using the MembershipHelper they come back as IPublishedContent entries, in which case I suspect the PropertyValueConverters would kick in and what you were trying would work.
Hi Nik,
Thank you so much for this input. I made some progress, but forgive me if I did not correctly implement your solution.
This is my code right now:
This is the result of it:
I have guids here after document/ , now i need to cut this guid and convert it , or something like that.
After hours of torture, finaly i found the solution.
I'm sure this is not the best solution so if someone has some suggestion for improvement please suggest it here :)
Thanks
is working on a reply...