asp.net mvc 3 - Bind radio button to single model preoperty in MVC3 -


how bind 2 radio buttons single model property in mvc using @html.radiobuttonfor()

in model:

public class mymodel {     public bool? doyouagree { get; set; } } 

in view:

<label>     @html.radiobuttonfor(m => m.doyouagree, false,          new { id = "doyouagree_false" })     no </label> <label>     @html.radiobuttonfor(m => m.doyouagree, true,          new { id = "doyouagree_true" })     yes </label> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -