ScaffoldColumn DataAnnotation attribute in MVC3 Razor

  1. The scaffoldColumn attribute hides a property from HTML helper such as EditorForModel and DisplayForModel.
  2. This attribute accepts a boolean parameter.
  3. With the attribute in place, EditorForModel will not render the control for property for which this attribute is set to false.

Example 1 :

In the above model class, we are using ScaffoldColumn on Age property and we are setting it to false. In View, we are rendering controls using EditorForModel HTML helper. It is expected that Age field will be hidden on UI.

View :

In the View we have used EditorForModel helper to display controls for Register Model.


You can see that Age property is missing from the form. 

Watch Video :