EnumDropDownListFor有条件地隐藏项目

时间:2014-05-14 09:15:14

标签: c# asp.net asp.net-mvc asp.net-mvc-5

我想根据用户是否登录来有条件地隐藏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
我试过调查AutoGenerateFilterAutoGenerateField属性无济于事。

查看

@Html.EnumDropDownListFor(x => x.sortType, new { id = "orderResults" })

0 个答案:

没有答案
相关问题