Edit

Share via


DisplayAttribute.AutoGenerateFilter Property

Definition

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

Property Value

true if UI should be generated automatically to display filtering for this field; otherwise, false.

Exceptions

An attempt was made to get the property value before it was set.

Examples

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  

Remarks

Do not use this property to get the value of the AutoGenerateFilter property. Use the GetAutoGenerateFilter method instead.

Setting this property overrides the default behavior for specifying which columns are included as filters.

Applies to