首页 > 解决方案 > Asp .Net MVC Kendo grid Tag Helper,根据其文本过滤枚举

问题描述

如何添加过滤器下拉列表来选择要过滤的文本?

public enum AppointmentType : byte
{
        [Display(ResourceType = typeof(Titles), Name = "OnlineVideoCall")]
        VideoCall = 1
}

在视图模型上:

public string AppointmentStringType {get;set;}
public AppointmentType AppointmentType{get;set;}

在后端:

_db.Appointments.Select(r => new AppointmentViewModel(){
    AppointmentStringType = r.AppointmentType.GetDisplayName(),
    AppointmentType = r.AppointmentType
});

在 .cshtml 上:

   <column field="@nameof(AppointmentViewModel.AppointmentType)" title="@Captions.AppointmentType" template="#= data.AppointmentStringType #" width="100"/>

标签: c#asp.net-mvcenumskendo-grid

解决方案


推荐阅读