How to write dashed attributes of html (5) element using ASP.NET MVC Helper methods?

 Posted by Sheonarayan on 10/25/2013 | Category: ASP.NET MVC Interview questions | Views: 5342 | Points: 40
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 

Comments or Responses

Login to post response