how to fill model enum with bradio button asp razor
@{var numList = Enum.GetValues(typeof(Models.numbers));}
@foreach (object radiotext in numList)
{
@Html.RadioButton("radioname", radiotext.ToString())@radiotext.ToString()
}
how to fill model enum with bradio button asp razor
@{var numList = Enum.GetValues(typeof(Models.numbers));}
@foreach (object radiotext in numList)
{
@Html.RadioButton("radioname", radiotext.ToString())@radiotext.ToString()
}
how to fill model enum with bradio button asp razor
namespace Models
{
public enum numbers
{
one = 1,
two = 2,
three = 3
}
}
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; }
}
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())
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us