By default, pickers will usually return you a collection of the generic IPublishedContent type. However if you are using ModelsBuilder so already have strongly type models to cast to for the individual items, and are also quite sure that you're only ever going to be picking items of this type in the picker otherwise they will be filtered out, you should be able to get a strongly typed collection out instead by using the OfType< T >() method on the end to do something like:-
foreach (var item in typedMultiNodeTreePicker.OfType<ProfileItem>())
{
<p><a href="@item.Url()">@item.Name</a></p>
<p>@item.EmployeePosition</p>
}
Then you would be able to access the strong EmployeeImage and EmployeePosition properties on @item.
Re-usable content
I am trying to build a directory on the backend that I can use across my site, Does any one have a good example or tutorial I can follow?
I would like to create a ContentType called User Profiles Page that gets filled with User Profiles Items (Employee Name, Position, Bio, Etc)
What I am trying to do is create a Block that has a list of all the profiles so I can select which onces show on each page.
Hi Yaco,
You can use a folder with nodes that will store information you want to use on other pages with Content Picker or Multinode Tree Picker.
Thanks, Alex
I am doing some testing using the Multinode Tree Picker
I created this tree structure
The Tree node allows Profile Item to be selected.
I am using this code to display the items
Is there a way for me to get to the properties of the item?
I would like to get the EmployeeImage and EmployeePosition properties
Hi Yaco
By default, pickers will usually return you a collection of the generic IPublishedContent type. However if you are using ModelsBuilder so already have strongly type models to cast to for the individual items, and are also quite sure that you're only ever going to be picking items of this type in the picker otherwise they will be filtered out, you should be able to get a strongly typed collection out instead by using the OfType< T >() method on the end to do something like:-
Then you would be able to access the strong EmployeeImage and EmployeePosition properties on @item.
Best regards, Terence
is working on a reply...