the @Html.RadioButtonFor
always confuses me right now I have in a ViewModel a property of an enum(lets say DayOfWeek as it is built in)
public class VM
{
public DayOfWeek SelectedDayOfWeek { get; set; }
}
in my view I have
@Html.RadioButtonFor(x => x.Vm.SelectedDayOfWeek,false, new {@id = "Sun"})
@Html.RadioButtonFor(x => x.Vm.SelectedDayOfWeek,false, new {@id = "Mon"})
Now this works but how do I get it to work for editing. For instance they want to edit the day of week they set. I want to show them which option they choose.
How could I do this. As you see right now it is hardcoded to false.
Don't really want to do this
@Html.RadioButtonFor(x => x.Vm.SelectedDayOfWeek,@SelectedSunValue, new {@id = "Sun"})
@Html.RadioButtonFor(x => x.Vm.SelectedDayOfWeek,@SelectedMonValue, new {@id = "Mon"})