Hello
Does anyone know how to bind a Yes/No radio button to a boolean property of a Strongly Typed Model in ASP.NET MVC.
Model
public class MyClass
{
public bool Blah { get; set; }
}
View
<%@ Page Title="blah" Inherits="MyClass"%>
<dd>
<%= Html.RadioButton("blah", Model.blah) %> Yes
<%= Html.RadioButton("blah", Model.blah) %> No
</dd>
Thanks
SOLUTION:
Thanks for Brian for the direction but it was the opposite of what he wrote. As so -
<%@ Page Title="blah" Inherits="MyClass"%>
<dd>
<%= Html.RadioButton("blah", !Model.blah) %> Yes
<%= Html.RadioButton("blah", Model.blah) %> No
</dd>