Intersoft WebGrid Documentation
WebGridFilter Class
Members  Example  See Also  Send Feedback
ISNet.WebUI.WebGrid Namespace : WebGridFilter Class






Represents a filter column that belongs to a WebGridTable object. Filtering is an important function for users who need to find data in a more rapid and productive way.

Object Model

WebGridFilter Class

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute()>
<SerializableAttribute()>
Public Class WebGridFilter 
   Inherits WebGridGroup
   Implements ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.WebUI.INamedObject 
Visual Basic (Usage)Copy Code
Dim instance As WebGridFilter
C# 
[DescriptionAttribute()]
[SerializableAttribute()]
public class WebGridFilter : WebGridGroup, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.WebUI.INamedObject  
Delphi 
public class WebGridFilter = class(WebGridGroup, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.WebUI.INamedObject)
JScript 
DescriptionAttribute()
SerializableAttribute()
public class WebGridFilter extends WebGridGroup implements ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.WebUI.INamedObject 
Managed Extensions for C++ 
[DescriptionAttribute()]
[SerializableAttribute()]
public __gc class WebGridFilter : public WebGridGroup, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.WebUI.INamedObject  
C++/CLI 
[DescriptionAttribute()]
[SerializableAttribute()]
public ref class WebGridFilter : public WebGridGroup, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.WebUI.INamedObject  

Example

The example below shows you how to create a WebGridFilter programmatically. It filters the City column with name London.
C#Copy Code
private void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
        DataSet ds = new DataSet();
        oleDbDataAdapter1.Fill(ds);
        e.DataSource = ds;
}

private void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
        if(!IsPostBack)
        {
                WebGrid1.RetrieveStructure();           
        }

       WebGridFilter a = new WebGridFilter();
       a.ColumnMember = "City";
       a.FilterType = ISNet.WebUI.WebGrid.ColumnFilterType.Like;
       a.FilterText = "London";
       WebGrid1.RootTable.FilteredColumns.Add(a);        
}

private void WebGrid1_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)
{
     e.Layout.AllowFilter = ISNet.WebUI.WebGrid.Filter.Yes;
}

Remarks

WebGrid.NET Enterprise 5.0 maintain the filtering feature that has been enhanced in the previous version. In WebGrid.NET Enterprise 5.0 you will find a new feature AutoFilterSuggestion, in which you can easily perform data filtering based on the currently selected cell. The new feature AutoFilterSuggestion allows you to easily perform data filtering based on the currently selected cell.

The enhancements that has been made on Filtering in WebGrid.NET 5.0 Enterprise includes: 

  • Added FilterKeyField property so that you can display a field but filter another field.
  • Improved filtering mechanism for even better performance.
  • Reengineered filter row to use the same navigation mode and behavior as in editing mode. You can now  enjoy our unique editing navigation mode in filter row as well. Keyboard events have also been improved to allow navigation to filter row by using Home or Up arrow key.
  • Added capability to use the same edit type in filter row. You can also choose different edit type for filter row by  setting the FilterEditType property. This property will allow you to put Calendar, Dropdownlist, and even WebComboNET in the filter row for better filtering experience.
  • Added numerous new filter types, such as NotEqual, NotBetween, Null, IsNull and more.
  • Filter Row can now be hidden/shown in column context menu.
  • Added row context menu in filter row. 
  • Filter types now displayed based on column's data type. Unrelated filters will be automatically removed from the list. This enhancement is automatic and does not need further configuration.
  • Special date range filters. When AutoFilterSuggestion is set to true, user can choice wider choice of date range filters in the column's or cell's context menu. The special date range filters are like Today, Tomorrow, Yesterday, Next Week, Next Month and so on.
  • Added "Contains" and "Does Not Contain" as new filter types for string data type.

 

You can perform CustomFiltering in WebGrid. For instance, you want to display the name of category instead of numbers of product's category. Assuming that the number of product's category and the category name are on two different tables, the problem might occurs when you want to filter the row and you have to filter it using numbers. The solution to solve this problem is using custom filtering. When a filter or more is applied to the grid, it will check the column with WebValueList applied to it and then do some manipulation on how data is suppose to be filtered. What it actually does is it filters a column which is not rendered in the grid, not the column you thought you are filtering. 

WebGridFiter allows developers to save FilterRow values using cookies. For instance, they want to customize the filter area of WebGrid by directly showing the list of customers' name starting with the word "A". Therefore, every time the page is first loaded, it will check whether a cookie for that page exist. If the cookie exists, then the cookie value will be captured and  a filter will be added to a column based on the cookie value.

WebGridFilter also allows you to customize the FilterEditType on the row that you want to filter. There are numerous filter edit types, such as: SameAsEditType (the default value), TextBox, DropdownList, NoEdit, CheckBox, and CalendarCombo.

The AutoFilterSuggestion automatically adds filter suggestions based on the data type and value of the selected cell. The benefits of this feature include: allow users to quickly filter data without has to type in the filter bar, and allow users to turn off AllowFiltering/FilterBar when they perform filtering on existing data. This feature is best used along with Filter Status Indicator feature. The filter indicator is useful to represent the current state of data when filter bar is not visible. To enable this feature simply set the ShowFilterStatus property to True.

Inheritance Hierarchy

System.Object
   ISNet.WebUI.WebUIBaseClass
      ISNet.WebUI.NamedObjectBase
         ISNet.WebUI.WebGrid.WebGridGroup
            ISNet.WebUI.WebGrid.WebGridFilter

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.