Answer: To write dashed attribute of HTML element using ASP.NET MVC Helper methods, we replace "-" with "_" in the anonymous type parameter. eg.
@using (Html.BeginForm("Create", "Home", FormMethod.Post,
new { data_validatable=true }))
returns below output
<form action="/Home/Create" method="Post" data-validatable="true" >
Notice, the data-validate attribute of the form element.
Asked In: Many Interviews |
Alert Moderator