I'm having trouble with a Content Picker on a Media Item. My problem is that when I give the content picker a node, it will return the node id however if the content picker has no node selected then it will return 'umbraco.MacroEngines.DynamicXml' I've tried everything I can think of to check weather the content picker has no node selected but nothing works as it's returing the above stated!
I'd be greatful if someone could help me out with this problem, how can I check if the content picker is empty?
Did you solve above problem. I have same problem. @Sobins suggestion unfortunaly does not work , it will always return true (no matter if content picker is empty or not)
Hi Nicolai, I can tell you that I did solve the problem, but now theres a new problem. I can't remember what project this was for so I have no way of finding the fix for you. Sorry. :/
Empty Content Picker
Hi there,
I'm having trouble with a Content Picker on a Media Item. My problem is that when I give the content picker a node, it will return the node id however if the content picker has no node selected then it will return 'umbraco.MacroEngines.DynamicXml' I've tried everything I can think of to check weather the content picker has no node selected but nothing works as it's returing the above stated!
I'd be greatful if someone could help me out with this problem, how can I check if the content picker is empty?
Thanks in advance!
Luke
Hi ,
you can try this...
@if(item.HasProperty("propertyname") &&!string.IsNullOrEmpty(item.propertyname.ToString())) {
//do some codes..
}
Hi Luke and Sobin
Did you solve above problem. I have same problem. @Sobins suggestion unfortunaly does not work , it will always return true (no matter if content picker is empty or not)
see my thread here: http://our.umbraco.org/forum/developers/razor/40892-HasValue,-HasProperty-checking-Content-Picker-with-razor-problem?p=0#comment149566
Best Regards
Nicolai
Hi Nicolai, I can tell you that I did solve the problem, but now theres a new problem. I can't remember what project this was for so I have no way of finding the fix for you. Sorry. :/
Dont you want to check if the contentpicker is null?
if(item.HasProperty("propertyname") && item.getproperty("") != null)
{
}
Charlie :)
is working on a reply...