<div>
<label>
<input type="radio" name="Connection" value="Heart">
Heart
</label>
</div>
<div>
<label>
<input type="radio" name="Connection" value="Spade">
Spade
</label>
</div>
While I'm on this ASP.NET MVC will model bind based on the name of a radio button and not the id as, duh, obviously the id should not be the same across numerous radio buttons, and, yet, .NET has a bad habit of just assigning the same id to numerous radio buttons. If you want to fight this "feature" in the RadioButtonFor Razor markup you may do so like this:
@Html.RadioButtonFor(m => m.Connection, "Heart", new {id="heart"})
No comments:
Post a Comment