So a Multi Node Treepicker will return a collection of published content eg. IEnumerable<IPublishedContent> Each of these items will have a corresponding document type. Presumably a Video is a different document type to a Article? In that case you can check the alias to see what type it is an act accordingly:
So assuming that items is IEnumerable<IPublishedContent> that comes from your MNTP then something like this could work:
foreach (var item in items)
{
if (item.ContentType.Alias == "video")
{
<a href="...">Video Link</a>
}
else if (item.ContentType.Alias == "article")
{
<a href="...">Article Link</a>
}
}
It's just a kind of tag.
So they both have the same document type (with, of course, name, description, and a pickable image).
So they are the same on the back. It is the image that separates them from the front.
So now I want to be able to define the link differently based on the name. But your answer and a fresh look in the morning managed to lead me to a result.
Get current used/picked repository item
Hey,
I have a kind of knowledge base. Within these items you can choose a theme from a repository (Video - Article) from a MultiNodeTreepicker.
Now I want to make an if statement based on which theme is chosen. So roughly the following:
I can read all possible themes, but not a single/current one.
Who can help me :noob
So a Multi Node Treepicker will return a collection of published content eg.
IEnumerable<IPublishedContent>
Each of these items will have a corresponding document type. Presumably a Video is a different document type to a Article? In that case you can check the alias to see what type it is an act accordingly:So assuming that
items
isIEnumerable<IPublishedContent>
that comes from your MNTP then something like this could work:It's just a kind of tag. So they both have the same document type (with, of course, name, description, and a pickable image). So they are the same on the back. It is the image that separates them from the front.
So now I want to be able to define the link differently based on the name. But your answer and a fresh look in the morning managed to lead me to a result.
Hi Peter ,
First of all, allow only one node maximum in you MNTP. Like Below
I believe , In Single Page only 1 theme is allowed. if Yes, Then Run below Variable to get the theme name
var themeName=Model.Value<>
if(!string.isNullOrEmpty(themeName)){ if(themeName=video) { // task } else if(themeName=article) { // task } } else { // task }
Thanks, Shekhar
is working on a reply...