public enum SmsType
{
[Display(Name = "خبری")]
Name=0,
[Display(Name = "عادی")]
Standard=1,
}
public IActionResult Index()
{
ViewBag.SmsType=new SelectList(Enum.GetNames(typeof(SmsType)));
return View();
}
In the view
`I want it to be displayed in the displayName view?It can also be displayed selectively in the view I need help.
Do you want it like below ?
in the view:
<select asp-items="Html.GetEnumSelectList<SmsType>()">
<option selected="selected" value="">Please select</option>
</select>
result: