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
Post a Comment