2
局部枚舉列表比方說,我有一個枚舉這樣的:顯示在ASP.NET核心下拉列表
public enum ContactPhoneType
{
[Display(Name = "")]
None = 0,
[Display(Name = "Home Phone")]
HomePhone = 1,
[Display(Name = "Cell/Mobile Phone")]
CellMobile = 2,
[Display(Name = "Work Phone")]
Work = 3,
[Display(Name = "Family Member")]
FamilyMember = 4,
[Display(Name = "Fax Number")]
Fax = 5,
[Display(Name = "Other")]
Other = 6,
}
我想從列表中只顯示第6。我怎樣才能隱藏最後一個?
對於示出的所有項目中,我使用下面的代碼:
<div class="form-group">
<label class="col-sm-4 control-label" asp-for="PhoneNumberType"></label>
<div class="col-sm-6">
<select asp-for="PhoneNumberType" asp-items="Html.GetEnumSelectList<ContactPhoneType>()" class="form-control"></select>
</div>
</div>