Over the years, I've often needed to do various things to a property, like make a property read only, or, to hide it from content editors completely. Luckily Episerver provides us some handy attributes to help us.
Hiding A Property
This can be done by adding the [Ignore] attributes on top of your properties, like so:
Adding this attribute to your property will allow you to save data to the property in code but a content editor will never see it within Episerver.
Making a read-only property
The next attribute in our Episerver toolkit is the read-only attribute. Adding this to a property will show it in the Episerver editor but it will be greyed out and the content editor won't be able to edit it.
An alternative way of hiding a property in edit mode
An alternative way of hiding a property is using the [ScaffoldColumn] attribute. When ScaffoldColumn is set to false, the ScaffoldColumn will hide the property from editors. In Episerver language to scaffold a property means that a content editor may be able to see the rendered value in preview mode, they won't see the blue editable box around it and they won't be able to click on the property to edit it. The property won't be visible in forms editing mode either.