Ive created a new label in a document called 'worthATry'. This label stores an integer. when i try calling this property into a variable in c# i get "Object reference not set to an instance of an object" error, but when i try a different property like a tickbox (returning 1 or 0) it works perfectly. is there a reason i cannot convert a textsring or label to an int?
int INT3 = Convert.ToInt32(n.GetProperty("worthATry").Value); // doesnt work
int INT3 = Convert.ToInt32(n.GetProperty("tickbox ").Value); //does work
i have definitely used the correct alias for the property.
Converting label or textstring to int
Ive created a new label in a document called 'worthATry'. This label stores an integer. when i try calling this property into a variable in c# i get "Object reference not set to an instance of an object" error, but when i try a different property like a tickbox (returning 1 or 0) it works perfectly. is there a reason i cannot convert a textsring or label to an int?
int INT3 = Convert.ToInt32(n.GetProperty("worthATry").Value); // doesnt work
int INT3 = Convert.ToInt32(n.GetProperty("tickbox ").Value); //does work
i have definitely used the correct alias for the property.
Turns out the property wasnt getting read at all, umbraco was messed up. after i deleted the umbraco.config and republished the site it was fine!
is working on a reply...