asp.net mvc - Defining a html5 data attribute in MVC -
i'm trying declare html.radio button in mvc app , want output data- attribute. problem c# "-"
<%= html.radiobutton("defaultradiobutton", d.link, d.isdefault, new { data-link = d.link })%>
is there anyway round other outputting html myself or creating helper?
thanks..
if asp.net mvc 3:
<%= html.radiobutton( "defaultradiobutton", d.link, d.isdefault, new { data_link = d.link } )%>
and underscore automatically converted dash helper.
in previous versions of mvc ugly hack appiled:
<%= html.radiobutton( "defaultradiobutton", d.link, d.isdefault, new dictionary<string, object> { { "data-link", d.link } } ) %>
Comments
Post a Comment