This is a migrated thread and some comments may be shown as answers.

How to achieve different filtering for different columns in RadGrid

3 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bibhudutta
Top achievements
Rank 1
Bibhudutta asked on 24 Jan 2012, 08:06 AM
I am new to Telerik. I have implemeted Telerik RadGrid, in that I have "Conatins" as the default Filtering option for all columns. But now I want it to be specific to some columns. Thats means for few columns I want "Contains" as the filtering option and for few I want "EqualTo" to be the filtering option. I have " Google Like " filtering, so no filter button next to the textbox feild to display the filter options. How can I achieve this ?

Please Help me out . Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Jan 2012, 08:13 AM
Hello,

You can reduce the filter options as per your requirement. Check the following help documentation which explains more about this.
Reducing the Filter Menu Options.

-Shinu.
0
Bibhudutta
Top achievements
Rank 1
answered on 24 Jan 2012, 08:17 AM
I donot want to reduce the filter option set, but to change the filter type, which be different for different columns. Can you help ?
0
Andrey
Telerik team
answered on 26 Jan 2012, 04:00 PM
Hi,

You need to change the implementation of the SelectedIndexChanged event in the custom filter column class:

private void list_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)o).NamingContainer;
            if ((this.UniqueName == "Index"))
            {
                //this is filtering for integer column type
                filterItem.FireCommandEvent("Filter", new Pair("EqualTo", this.UniqueName));
            }
            //filtering for string column type
            filterItem.FireCommandEvent("Filter", new Pair("Contains", this.UniqueName));
        }

You could follow the same approach, you should only change the conditions in the if statements  to check whether the desired ComboBox is the one that is created and then to assign the required filter function.

Give this approach a try and check whether this is the desired behavior.

Kind regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Bibhudutta
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Bibhudutta
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or