@this.Html.CheckBoxFor(m => m.MyModel.MyBoolProperty, new { @class="myCheckBox", extraAttr="23521"})
With razor, I’m unable to specify values for data- attributes such as data-externalid="23521"
Is there a way to do this using @this.Html.CheckBoxFor(...)?
The
_will automatically be converted to-in the resulting markup:And that’s true for all Html helpers taking a
htmlAttributesanonymous object as argument, not only theCheckBoxForhelper.