RadControls version
|
3.5 |
.NET version |
3.5 |
Visual Studio version |
2008 |
programming language |
C# |
browser support |
all browsers supported by RadControls
|
PROJECT DESCRIPTION
This is an extension to the
(ID#696) "Google suggest" style filtering in RadGrid filter example. This project uses ideas from the aforementioned example heavily but puts the relative code in a custom column type inherited from the GridBoundColumn.
To implement you:
- Create a new class that inherits from the GridBoundColumn
- Create a viewstate string array to contain any distinct string values for the column.
- Override the SetupFilterControls, SetCurrentFilterValueToControl, GetCurrentFilterValueFromControl methods replacing the normal filter textbox with the radComboBox just as in the previous example, with the addition of wiring up the OnDataBound for the owner
- In the Owner's DataBound, loop through the datasource and look for the property on the object that is the Datafield of the column, or loop through a datatable's column of the same name and add any values you do not already have to the distinct string alue array.
- In the ComboBox ItemsRequested we bind it to the distinct values for the colum.
- For ease of clearing the filter, you may add a "Clear" button that would clear the column's filter by setting the ComboxBox.Text to empty string and clearing the CurrentFilterValue and CurrentFilterFunction properties