Spread for ASP.NET 13 Product Documentation
Spread for ASP.NET 13 Product Documentation / Developer's Guide / Customizing User Interaction / Managing Filtering of Rows of User Data / Using Enhanced Filtering
In This Topic
    Using Enhanced Filtering
    In This Topic

    When the control has enhanced filtering turned on, the user can drop-down a list of available filters to apply to the data.

    The default filter that is displayed depends on the data in the column. The filter can be a number, text, date, or color filter.

    The filters are described in the following table.

    Filter Type Description
    Number Filters  
    Equals Values in rows are equal to condition
    Does Not Equal Values in rows do not equal condition
    Greater Than Values in rows are greater than condition
    Greater Than Or Equal To Values in rows are greater than or equal to condition
    Less Than Values in rows are less than condition
    Less Than Or Equal To Values in rows are less than or equal to condition
    Between Values in rows are greater than one condition and less than another condition
    Top 10 Values in the rows with the ten highest values
    Above Average Values in the rows that are above the average of the values in all the rows
    Below Average Values in the rows that are below the average of the values in all the rows
    Custom Filter Values in rows that meet the conditions of a custom filter
    Text Filters  
    Equals Values in rows equal the condition
    Does Not Equal Values in rows do not equal the condition
    Begins With Values in rows begin with the specified characters
    Ends With Values in rows end with the specified characters
    Contains Values in rows contain the specified characters
    Does Not Contain Values in rows do not contain the specified characters
    Custom Filter Values in rows that meet the conditions of a custom filter
    Date Filters  
    Equals Values in rows equal the condition
    Before Values in rows are dates before the condition
    After Values in rows are dates after the condition
    Between Values in rows are dates between two specified dates for the condition
    Tomorrow Values in rows are tomorrow's date
    Today Values in rows are today's date
    Yesterday Values in rows are yesterday's date
    Next Week Values in rows are during next week
    This Week Values in rows are during current week
    Last Week Values in rows are during last week
    Next Month Values in rows are during next month
    This Month Values in rows are during current month
    Last Month Values in rows are during last month
    Next Quarter Values in rows are during next quarter
    This Quarter Values in rows are during current quarter
    Last Quarter Values in rows are during last quarter
    Next Year Values in rows are during next year
    This Year Values in rows are during current year
    Last Year Values in rows are during last year
    Year to Date Values in rows are during current year to present date
    All Dates in the Period Values in rows are within a specified period
    Custom Filter Values in rows that meet the conditions of a custom filter

    Users can specify wildcards in conditions. The "?" character represents any single character. The "*" character represents any series of characters.

    When the user chooses a filter, the control either filters the data to display only the items that match the filter criteria, or the control displays the rows that meet the criteria with one appearance, and the rows that do not meet the criteria with another appearance. For information about setting the styles for rows, see Creating Filtered Rows and Setting the Appearance.

    Using Code

    Set the AutoFilterMode property to Enhanced, create a filter style, and then apply the filter to the sheet.

    Example

    The following example creates an enhanced filter in the first three columns. Add different types of data to see the various filter options.

    C#
    Copy Code
    FpSpread1.Sheets[0].AutoFilterMode = FarPoint.Web.Spread.AutoFilterMode.Enhanced;
    FarPoint.Web.Spread.NamedStyle instyle = new FarPoint.Web.Spread.NamedStyle();
    FarPoint.Web.Spread.NamedStyle outstyle = new FarPoint.Web.Spread.NamedStyle();
    instyle.BackColor = Color.Yellow;
    outstyle.BackColor = Color.Aquamarine;
    FarPoint.Web.Spread.FilterColumnDefinition fcd = new FarPoint.Web.Spread.FilterColumnDefinition(1, FarPoint.Web.Spread.FilterListBehavior.SortByMostOccurrences | FarPoint.Web.Spread.FilterListBehavior.Default);
    FarPoint.Web.Spread.FilterColumnDefinition fcd1 = new FarPoint.Web.Spread.FilterColumnDefinition(2);
    FarPoint.Web.Spread.FilterColumnDefinition fcd2 = new FarPoint.Web.Spread.FilterColumnDefinition();
    FarPoint.Web.Spread.StyleRowFilter sf = new FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets[0], instyle, outstyle);
    sf.AddColumn(fcd);
    sf.AddColumn(fcd1);
    sf.AddColumn(fcd2);
    FpSpread1.Sheets[0].RowFilter = sf;
    VB
    Copy Code
    FpSpread1.Sheets(0).AutoFilterMode = FarPoint.Web.Spread.AutoFilterMode.Enhanced
    Dim instyle As New FarPoint.Web.Spread.NamedStyle()
    Dim outstyle As New FarPoint.Web.Spread.NamedStyle()
    instyle.BackColor = Drawing.Color.Yellow
    outstyle.BackColor = Drawing.Color.Aquamarine
    Dim fcd As New FarPoint.Web.Spread.FilterColumnDefinition(1, FarPoint.Web.Spread.FilterListBehavior.SortByMostOccurrences Or FarPoint.Web.Spread.FilterListBehavior.Default)
    Dim fcd1 As New FarPoint.Web.Spread.FilterColumnDefinition(2)
    Dim fcd2 As New FarPoint.Web.Spread.FilterColumnDefinition()
    Dim sf As New FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets(0), instyle, outstyle)
    sf.AddColumn(fcd)
    sf.AddColumn(fcd1)
    sf.AddColumn(fcd2)
    FpSpread1.Sheets(0).RowFilter = sf
    See Also