我想根据用户是否登录来有条件地隐藏EnumDropDownListFor
中的元素。
枚举
public enum SortType
{
[Display(ResourceType = typeof(NavigationItems), Name = "BestMatch")]
Best_Match = 0,
[Display(ResourceType = typeof(NavigationItems), Name = "Alphabetical")]
Alphabetical,
[Display(ResourceType = typeof(NavigationItems), Name = "PriceAsc")]
PriceAsc,
[Display(ResourceType = typeof(NavigationItems), Name = "PriceDesc")]
PriceDesc
}
我想隐藏的项目是PriceAsc
& PriceDesc
我试过调查AutoGenerateFilter
和AutoGenerateField
属性无济于事。
查看
@Html.EnumDropDownListFor(x => x.sortType, new { id = "orderResults" })