I'm currently working on a project in 7.6.1 and i ran into an issue with the Multinode Tree picker. When I select two or more nodes, I want the last selected item to behave differently from the rest. I set up a code which seems to not work quite as expected:
@if(CurrentPage.HasValue("experts")){
var expertList = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("experts");
@foreach(var expert in expertList){
<div>do some of this and that</div>
if(!expert.IsLast()){
<div>do something special</div>
}
}}
Works not entirely as i figured, since it counts unselected nodes in the parentfolder aswell, thus IsLast is not working. Any suggestions?
@if (CurrentPage.HasValue("experts"))
{
var expertList = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("experts");
var last = expertList.Last();
foreach (var expert in expertList)
{
<div>do some of this and that</div>
if (!expert.Equals(last))
{
<div>do something special</div>
}
}
}
Last item from Multinode Tree Picker
Hello guys,
I'm currently working on a project in 7.6.1 and i ran into an issue with the Multinode Tree picker. When I select two or more nodes, I want the last selected item to behave differently from the rest. I set up a code which seems to not work quite as expected:
Works not entirely as i figured, since it counts unselected nodes in the parentfolder aswell, thus IsLast is not working. Any suggestions?
Hi Lex
Try this code:
Thanks,
Alex
Thanks Alex, that did the trick!
You are welcome, have a nice day!
Alex
is working on a reply...