I'm not used to working with ModelsBuilder, but with Umb8 i'm trying to get stuff to work.. Only running into a minor issue.
I believe I used to check if a treepicker had any values like this:
@if(Models.treePickerExample.Any())
{
foreach(var item in Models.treePickerExample){
doStuff();
}
}
Or like this
@if(Models.treePickerExample.Count() > 0)
{
foreach(var item in Models.treePickerExample){
doStuff();
}
}
But currently this doens't seem to work, it both passed the check and goes to the foreach, but it breaks when there aren't any items selected.. Am I missing something?
I've got it working, but it feels like it's not the best method:
Multinodetreepicker and Modelsbuilder
'Evening
I'm not used to working with ModelsBuilder, but with Umb8 i'm trying to get stuff to work.. Only running into a minor issue.
I believe I used to check if a treepicker had any values like this:
Or like this @if(Models.treePickerExample.Count() > 0) { foreach(var item in Models.treePickerExample){ doStuff(); } }
But currently this doens't seem to work, it both passed the check and goes to the foreach, but it breaks when there aren't any items selected.. Am I missing something?
I've got it working, but it feels like it's not the best method:
Or is this the correct way currently? There seems to be a bit of lack of documentation ;-)
Edited it to
A treepicker returns null if empty, so check if it's not null ;-)
is working on a reply...