Spread ASP.NET 14
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / SheetView Class / RowFilter Property
Example


In This Topic
    RowFilter Property
    In This Topic
    Gets or sets the row filter for the sheet.
    Syntax
    'Declaration
     
    Public Property RowFilter As IRowFilter
    'Usage
     
    Dim instance As SheetView
    Dim value As IRowFilter
     
    instance.RowFilter = value
     
    value = instance.RowFilter
    public IRowFilter RowFilter {get; set;}

    Property Value

    IRowFilter object containing the row filter
    Example

    This example sets the filter for the rows.

    string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source= C:\\Patients2000.mdb";
    string sqlStr = "SELECT * FROM Patients";
    System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr);
    DataSet ds = new DataSet();
    System.Data.OleDb.OleDbDataAdapter daCust = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn);
    daCust.Fill(ds);
    FpSpread1.DataSource = ds; 
    
    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(3);
    
    FarPoint.Web.Spread.HideRowFilter hf = new FarPoint.Web.Spread.HideRowFilter(FpSpread1.ActiveSheetView);
    hf.AddColumn(fcd);
    hf.AddColumn(fcd1);
    hf.AddColumn(fcd2);
    FpSpread1.ActiveSheetView.RowFilter = hf;
    Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source= C:\Patients2000.mdb"
    Dim sqlStr As String = "SELECT * FROM Patients"
    Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr)
    Dim ds As DataSet = New DataSet
    Dim daCust As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
    daCust.Fill(ds)
    FpSpread1.DataSource = ds
    
    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(3)
    
    Dim hf As New FarPoint.Web.Spread.HideRowFilter(FpSpread1.ActiveSheetView)
    hf.AddColumn(fcd)
    hf.AddColumn(fcd1)
    hf.AddColumn(fcd2)
    FpSpread1.ActiveSheetView.RowFilter = hf
    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.Gray;
    FarPoint.Web.Spread.StyleRowFilter rf = new FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets[0], instyle, outstyle);
    FpSpread1.Sheets[0].RowFilter = rf;
    // Assign filter and customize filter options.
    FpSpread1.Sheets[0].RowFilter.AddColumn(1);
    FpSpread1.Sheets[0].RowFilter.ShowFilterIndicator = true;
    FpSpread1.Sheets[0].RowFilter.AllString = "Show All";
    FpSpread1.Sheets[0].RowFilter.BlanksString = "Show The Blanks";
    FpSpread1.Sheets[0].RowFilter.NonBlanksString = "Show The Non-Blanks";
    Dim instyle As New FarPoint.Web.Spread.NamedStyle()
    Dim outstyle As New FarPoint.Web.Spread.NamedStyle()
    instyle.BackColor = Color.Yellow
    outstyle.BackColor = Color.Gray
    Dim rf As New FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets(0), instyle, outstyle)
    FpSpread1.Sheets(0).RowFilter = rf
    ' Assign filter and customize filter options.
    FpSpread1.Sheets(0).RowFilter.AddColumn(1)
    FpSpread1.Sheets(0).RowFilter.ShowFilterIndicator = True
    FpSpread1.Sheets(0).RowFilter.AllString = "Show All"
    FpSpread1.Sheets(0).RowFilter.BlanksString = "Show The Blanks"
    FpSpread1.Sheets(0).RowFilter.NonBlanksString = "Show The Non-Blanks"
    See Also