Starting from MVC 3 and up this issue has been addressed. From MVC 3 and up underscores in HTML attributes are automatically converted to dashes. Here’s an example:
@Html.TextBox( "tbxOne", "", new { @data_id = "someId", @style= "width:120px; text-align:right;" })
This wil result in:
<input data-id="someId" name="tbxOne" type="text" value="" />
Leave A Comment