Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
it would be better if GetValue returned a null if the property didn't exist. I had to add a try catch around this call to get round this
You can't check for it being null or empty because it doesn't get that far
e.g. this doesn't help
var item = Model.Items.ElementAt(0); var foo = String.IsNullOrEmpty(item.GetValue<string>("bar")) ? item.GetValue<string>("bar") : "";
many thanks
Tom
Did you ever solve this?
Hi,
this is fixed in the source code on Github from a commit on 24th July, I grabbed it from there and it did solve the problem.
HTH
t
Any idea when this will be released as an final update?
Hi there,
I know that this question is pretty ancient by now, but here is my suggested and very simple solution which has resolved it for me when working with legacy Umbraco versions. 🙂 Hope it helps.
Best, Tom
public bool LeBlenderHasValue( string fieldName, Lecoati.LeBlender.Extension.Models.LeBlenderValue leblenderValue) { try { var testValue = leblenderValue.GetValue(fieldName); return true; } catch (Exception) { return false; } }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
item.GetValue throws and exception if the property doesn't exist
it would be better if GetValue returned a null if the property didn't exist. I had to add a try catch around this call to get round this
You can't check for it being null or empty because it doesn't get that far
e.g. this doesn't help
many thanks
Tom
Did you ever solve this?
Hi,
this is fixed in the source code on Github from a commit on 24th July, I grabbed it from there and it did solve the problem.
HTH
t
Any idea when this will be released as an final update?
Hi there,
I know that this question is pretty ancient by now, but here is my suggested and very simple solution which has resolved it for me when working with legacy Umbraco versions. 🙂 Hope it helps.
Best, Tom
is working on a reply...