Answer: Use an underscore
In the cshtml view file definition when declaring the attributes in the new {} object class for the attributes, use data_mycustomdataattribute to render out data-mycustomdataattribute
@Html.Hidden("controlName", "valueHere", new { @data_mycustomdataattribute = "testing dash"})
This will render the following...
<input data-mycustomdataattribute="testing dash" id="controlName" name="controlName" type="hidden" value="valueHere">
No comments:
Post a Comment