I am trying to create a nice group of radio buttons with MVC and Bootstrap 3:
After selecting an option:
I store the value in the database but
Try below code to render bootstrap radio button group with default select feature
@{
foreach (var item in Model.GenderList)
{
}
}
@Html.ValidationMessageFor(m => m.Gender)
public enum Gender
{
Male = 0,
Female = 1,
RatherNotSay = 2
}
It is an IEnumerable property in Model class which can be populated in the Get controller action using the Gender Enum.
public IEnumerable> GenderList { get; set; }