DisplayAttribute.AutoGenerateFilter 属性

定义

获取或设置一个值,该值指示是否针对此字段自动显示筛选。Gets or sets a value that indicates whether filtering UI is automatically displayed for this field.

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

属性值

Boolean

如果应自动生成用户界面以显示此字段的筛选,则为 true;否则为 falsetrue if UI should be generated automatically to display filtering for this field; otherwise, false.

例外

在设置属性值之前,已尝试获取该属性值。An attempt was made to get the property value before it was set.

示例

下面的示例演示如何对 Employee1 字段禁用筛选器。The following example shows how to disable the filter for the Employee1 field.

[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  

注解

不要使用此属性获取属性的值 AutoGenerateFilterDo not use this property to get the value of the AutoGenerateFilter property. 请改用 GetAutoGenerateFilter 方法。Use the GetAutoGenerateFilter method instead.

设置此属性将重写默认行为,以指定作为筛选器包括的列。Setting this property overrides the default behavior for specifying which columns are included as filters.

适用于