Spread for ASP.NET 13 Product Documentation
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / AutoFilter Class / MinPrefixLength Property
Example


In This Topic
    MinPrefixLength Property
    In This Topic
    Gets or sets the minimum number of characters to start the filtering operation. The value must be greater than zero. The default value is 3.
    Syntax
    'Declaration
     
    Public Property MinPrefixLength As Integer
    'Usage
     
    Dim instance As AutoFilter
    Dim value As Integer
     
    instance.MinPrefixLength = value
     
    value = instance.MinPrefixLength
    public int MinPrefixLength {get; set;}
    Example
    This example filters out items when typing in the combo cell.
    FarPoint.Web.Spread.AutoFilter afilter = new FarPoint.Web.Spread.AutoFilter();
    afilter.Enabled = true;
    afilter.MatchingSource = FarPoint.Web.Spread.FilterMatchingSource.AllColumns;
    afilter.MinPrefixLength = 1;
    afilter.MaxFilteredItem = 10;
    
    System.Data.DataSet ds = new System.Data.DataSet();
    System.Data.DataTable emp = new System.Data.DataTable("Employees");
    System.Data.DataTable div = new System.Data.DataTable("Division");
    emp.Columns.Add("LastName");
    emp.Columns.Add("FirstName");
    emp.Rows.Add(new Object[] { "Jones", "Marianne" });
    emp.Rows.Add(new Object[] { "Fieldes", "Anna" });
    emp.Rows.Add(new Object[] { "Johnson", "Anna" });
    div.Columns.Add("Section");
    div.Columns.Add("Specialty");
    div.Rows.Add(new Object[] { "Finance", "Taxes" });
    div.Rows.Add(new Object[] { "Mergers", "Legal" });
    ds.Tables.AddRange(new System.Data.DataTable[] { emp, div });
    FarPoint.Web.Spread.MultiColumnComboBoxCellType mccbct = new FarPoint.Web.Spread.MultiColumnComboBoxCellType();
    mccbct.DataSource = ds;
    mccbct.VerticalAlign = VerticalAlign.Top;
    mccbct.AutoFilter = afilter;
    FpSpread1.ActiveSheetView.Cells[0, 0].CellType = mccbct;
    Dim afilter As New FarPoint.Web.Spread.AutoFilter()
    afilter.Enabled = True
    afilter.MatchingSource = FarPoint.Web.Spread.FilterMatchingSource.AllColumns
    afilter.MinPrefixLength = 1
    afilter.MaxFilteredItem = 10
    
    Dim ds As New System.Data.DataSet()
    Dim emp As New System.Data.DataTable("Employees")
    Dim div As New System.Data.DataTable("Division")
    emp.Columns.Add("LastName")
    emp.Columns.Add("FirstName")
    emp.Rows.Add(New Object() {"Jones", "Marianne"})
    emp.Rows.Add(New Object() {"Fieldes", "Anna"})
    emp.Rows.Add(New Object() {"Johnson", "Anna"})
    div.Columns.Add("Section")
    div.Columns.Add("Specialty")
    div.Rows.Add(New Object() {"Finance", "Taxes"})
    div.Rows.Add(New Object() {"Mergers", "Legal"})
    ds.Tables.AddRange(New System.Data.DataTable() {emp, div})
    Dim mccbct As New FarPoint.Web.Spread.MultiColumnComboBoxCellType()
    mccbct.DataSource = ds
    mccbct.VerticalAlign = VerticalAlign.Top
    mccbct.AutoFilter = afilter
    FpSpread1.ActiveSheetView.Cells(0, 0).CellType = mccbct
    See Also