c# - Unchecked Radio Button aspnet mvc -


i have radio button can started unchecked, when condition false, it's writting checked attribute in html , browser show checked

@html.radiobutton("radio", "1", new { @checked = (condition) }) @html.radiobutton("radio", "2", new { @checked = (condition) })

i think proper use

@html.radiobutton("radio", "1",  (condition)) 

according radiobutton , radio button constructor defined

radiobutton(string name,object value, bool ischecked) 

which produce

<!-- ischecked true. -->  <input type="radio" name="name" value="value" checked="checked" /> <!-- ischecked false. -->  <input type="radio" name="name" value="value" /> 

i think trying use new htmlattribute not needed.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -