Answers for "how to give value to model from radio button html asp with enums if checked"

0

how to give value to model from radio button html asp with enums if checked

@model MvcTest.Models.Airlines
@foreach (var value in Enum.GetValues(typeof(MvcTest.Models.Airlines)))
{
    @Html.RadioButtonFor(m => m, value)
    @Html.Label(value.ToString())
}
Posted by: Guest on November-22-2020
0

how to give value to model from radio button html asp with enums if checked

public class TestModel
{
    [Required(ErrorMessage = "select one item")]
    public Airlines Airline { get; set; }
}
Posted by: Guest on November-22-2020
0

how to give value to model from radio button html asp with enums if checked

@model Enum
@foreach (var value in Enum.GetValues(Model.GetType()))
{
    @Html.RadioButtonFor(m => m, value)
    @Html.Label(value.ToString())
}
Posted by: Guest on November-22-2020

Code answers related to "how to give value to model from radio button html asp with enums if checked"

Browse Popular Code Answers by Language