I want to remove the Blank/Empty entry from my EnumDropDownListfor - have searched online and tried below links but nothing seems to work
Remove blank/empty entry at top of EnumDropDownListFor box
Remove blank entry from EnumDropDownListFor(...)?
Code in View:-
<td>
@Html.EnumDropDownListFor(model => model.Actions, new { @id = "actions", @class = "form-control" })
</td>
Code in Model:-
[Required]
[Range(1, int.MaxValue, ErrorMessage = "Select an Action")]
[Display(Name = "Actions")]
public ItemTypes Actions { get; set; }
Enum in Controller:-
public enum ItemTypes
{
Add = 1,
Remove = 2
}
Dropdown renders as below:-