Using Radio Buttons

Unfortunately, we couldn't do a same method as we did earlier because MVC doesn't provide ViewBag for radio buttons.

What we could do is define the radio button in the view page. The value of radio button given in Entry models. Therefore, we have to call it first in top of the add view page.

@using Treehouse.FitnessFrog.Models

Then, we need to list the radio buttons one-by-one.

<div class="form-group">
    @Html.LabelFor(m => m.Intensity, new { @class = "control-label" })
    <div>
        <label class="radio-inline">
            @Html.RadioButtonFor(m => m.Intensity, Entry.IntensityLevel.Low)
                @Entry.IntensityLevel.Low
        </label>
        ...
    </div>
</div>

results matching ""

    No results matching ""