Attributes

htmlAttributes: new { @class = "form-control", Attributes.DynamicRequired }

Makes a field appear as required but not actually prevent saving. Used for fields that can display or hide based of client side logic.

Usage

@Html.EditorFor(model => model.MyField, new { htmlAttributes = new { @class = "form-control", Attributes.DynamicRequired } })