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

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -