Spread for ASP.NET 11 Product Documentation
Add Method (FilterItemCollection)
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > FilterItemCollection Class : Add Method
Custom filter item to add
Adds a filter item to the collection.
Syntax
'Declaration
 
Public Function Add( _
   ByVal filterItem As IFilterItem _
) As Integer
'Usage
 
Dim instance As FilterItemCollection
Dim filterItem As IFilterItem
Dim value As Integer
 
value = instance.Add(filterItem)
public int Add( 
   IFilterItem filterItem
)

Parameters

filterItem
Custom filter item to add
Exceptions
ExceptionDescription
No display name or length of the display name of the specified filter is zero
No specified custom filter or specified custom filter is null
Example
This example sets a row filter.
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;  
FarPoint.Web.Spread.FilterItemCollection fc;  
fc = fcd.Filters;  
 
foreach(FarPoint.Web.Spread.DefaultFilterItem df in fc) 
{ 
fc.Add(df); 
} 
Dim instyle As New FarPoint.Web.Spread.NamedStyle()
Dim outstyle As New FarPoint.Web.Spread.NamedStyle()
instyle.BackColor = Color.Yellow 
outstyle.BackColor = 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

Dim fc As FarPoint.Web.Spread.FilterItemCollection
fc = fcd.Filters
Dim df As FarPoint.Web.Spread.DefaultFilterItem
For Each df In fc
fc.Add(df)
Next
See Also

Reference

FilterItemCollection Class
FilterItemCollection Members