DisplayAttribute.AutoGenerateFilter 属性

定义

获取或设置一个值,该值指示是否针对此字段自动显示筛选。

public:
 property bool AutoGenerateFilter { bool get(); void set(bool value); };
public bool AutoGenerateFilter { get; set; }
member this.AutoGenerateFilter : bool with get, set
Public Property AutoGenerateFilter As Boolean

属性值

如果应自动生成用户界面以显示此字段的筛选,则为 true;否则为 false

例外

在设置属性值之前,已尝试获取该属性值。

示例

以下示例演示如何禁用 Employee1 字段的筛选器。

[MetadataType(typeof(EmployeeMD))]  
public partial class Employee {  
    public class EmployeeMD {  
        [Display(Name = "Last Name", Order = -9,   
            Prompt = "Enter Last Name", Description="Emp Last Name")]  
        public object LastName { get; set; }  

        [Display(Name = "Manager", AutoGenerateFilter=false)]  
        public object Employee1 { get; set; }  
    }  
}  
<MetadataType(GetType(EmployeeMD))>  _  
Public Class Employee  

    Public Class EmployeeMD  

        <Display(Name:="Last Name", Order:=-9, _  
           Prompt:="Enter Last Name", Description:="Emp Last Name")>  _  
        Public Property LastName As Object  
        End Property  

        <Display(Name:="Manager", AutoGenerateFilter:=false)>  _  
        Public Property Employee1 As Object  
        End Property  
    End Class  
End Class  

注解

请勿使用此属性获取属性的值 AutoGenerateFilter 。 请改用 GetAutoGenerateFilter 方法。

设置此属性将替代指定哪些列作为筛选器包含的默认行为。

适用于