asp.net - radiobuttonfor with data- with strange behaviour -


i'm trying make checkbox bool value model. works, i'm trying add data-* field checkbox in order add parameters nice bootstrap-switch component, , doesn't work:

<input data-val="true" id="actionlist_0__efficacity" name="actionlist[0].efficacity" type="radio" value="{ data_on_text = yeah}"> 

and should be

<input data-val="true" id="actionlist_0__efficacity" name="actionlist[0].efficacity" type="radio" data-on-text = "yeah"> 

so i've done:

@html.radiobuttonfor(x => x.efficacity, new { data_on_text = "yeah" } ) 

i tried editorfor can't put data_ editorfor apparently...

thanks help

the html , helper have shown don't quite match (the html suggests generating radio buttons collection because contains indexer or perhaps have editortemplate type represented property actionlist?) 2nd parameter of radiobuttonfor() object sets 'value' attribute. need change helper to

@html.radiobuttonfor(x => x.efficacity, somevalue, new { data_on_text = "yeah" } ) 

where somevalue value assigned property efficacity (for example string or enum)


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -