Hi,
I've just created an Item which I'm using for page properties.
When I in my layout template use the code below I get a NullReferenceException (System.NullReferenceException: Object reference not set to an instance of an object.)
But only on the pages that have not had their properties edited from backend... Isn't the PropertyItem attached to all pages when chosen on website settings?
I do check for null, but it's the var myField line it complains about (annonymized variable/field names ;-))...
@{ string myValue = ""; var myField = Model.PropertyItem.GetBoolean("MyCheckboxFieldName"); if(myField != null) { myValue = !Model.PropertyItem.GetBoolean("MyCheckboxFieldName") ? "" : "the-css-class-i-use"; } }