@Html.CheckBoxFor(
m => m.MyModel.MyBoolProperty,
new {
@class = "myCheckBox",
data_externalid = "23521"
}
)
The _
will automatically be converted to -
in the resulting markup:
<input type="checkbox" name="MyModel.MyBoolProperty" data-externalid="23521" class="myCheckBox" />
And that's true for all Html helpers taking a htmlAttributes
anonymous object as argument, not only the CheckBoxFor
helper.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With