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

Change default selectedItem to "Contains" when FieldFilterEditorCreated event triggers

7 Answers 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 27 Apr 2012, 09:23 AM
Hi,

First of all, excuse me for my poor english skills.

When I click on the FilterEditor of a GridView the default value of the field "Show rows with value that" is "Is equal to" and I would like to change the default value to "Contains".

Is there any way to achieve what I'm trying to do? Could you explain me how to implement it, please?

Thanks in advance.

PS- I hope you understand what I meant, if not, don't hesitate to ask.

7 Answers, 1 is accepted

Sort by
0
Victor
Top achievements
Rank 1
answered on 30 Apr 2012, 09:22 AM
I've found a solution for Telerik versions after the Q3 2011, but I don't know how to achieve the solution with versions before Q3 2011.

Could anybody help me, pleaz???

"The FilterOperatorsLoading event (Added Q3 2011) allows you to both remove unwanted operators and define a defaultly selected operator in a proper way. "
C#
private void GridView_FilterOperatorsLoading(object sender, Telerik.Windows.Controls.GridView.FilterOperatorsLoadingEventArgs e)
{
    if (e.AvailableOperators.Contains(FilterOperator.Contains))
    {
        e.DefaultOperator = FilterOperator.Contains;
    }
}
0
Rossen Hristov
Telerik team
answered on 30 Apr 2012, 09:32 AM
Hi,

I am afraid that you will have to upgrade if you want that functionality. The older versions do not have it and you cannot change the filter operator.

Regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Victor
Top achievements
Rank 1
answered on 30 Apr 2012, 09:44 AM
Thanks for the answer Ross. I guess I'll have to upgrade your product. Regards.
0
Sven J
Top achievements
Rank 2
answered on 08 Aug 2012, 08:21 AM
Hi

I used following EventHandler to set DefaultFilter 1 & 2:

            FilterOperatorsLoading += (sender, args) =>
            {
                args.DefaultOperator1 = FilterOperator.Contains;
                args.DefaultOperator2 = FilterOperator.Contains;
            };
But it seems that hitting ClearFilters resets the DefaultOperators to IsEqualTo... Best regards Sven
0
Yordanka
Telerik team
answered on 09 Aug 2012, 04:24 PM
Hi Sven,

This will not happen with the latest version - Q2 2012 SP1. Please give it a try and let us know if you still have problem.
 
Regards,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Victor
Top achievements
Rank 1
answered on 10 Aug 2012, 06:40 AM
Thank you very much Sven! 

I'll try it and let you know if it work for me.

Cheers!
0
Alan
Top achievements
Rank 1
answered on 20 Aug 2012, 09:39 PM
I am new to .net and Rad controls and need to implement something similar to:
FilterOperatorsLoading += (sender, args) =>
            {
                args.DefaultOperator1 = FilterOperator.Contains;
                args.DefaultOperator2 = FilterOperator.Contains;
            };
but I need to know what context this code should appear in.  Should this go in the contructor of the viewmodel for the view on which the RadGridView is implemented?
Tags
GridView
Asked by
Victor
Top achievements
Rank 1
Answers by
Victor
Top achievements
Rank 1
Rossen Hristov
Telerik team
Sven J
Top achievements
Rank 2
Yordanka
Telerik team
Alan
Top achievements
Rank 1
Share this question
or