Change default selectedItem to "Contains" when FieldFilterEditorCreated event triggers

8 posts, 0 answers
  1. Victor
    Victor avatar
    12 posts
    Member since:
    Feb 2011

    Posted 27 Apr 2012 Link to this post

    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.
  2. Victor
    Victor avatar
    12 posts
    Member since:
    Feb 2011

    Posted 30 Apr 2012 Link to this post

    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;
        }
    }
  3. DevCraft banner
  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 30 Apr 2012 Link to this post

    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 >>

  5. Victor
    Victor avatar
    12 posts
    Member since:
    Feb 2011

    Posted 30 Apr 2012 Link to this post

    Thanks for the answer Ross. I guess I'll have to upgrade your product. Regards.
  6. Sven J
    Sven J avatar
    26 posts
    Member since:
    Nov 2009

    Posted 08 Aug 2012 Link to this post

    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
  7. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 09 Aug 2012 Link to this post

    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.

  8. Victor
    Victor avatar
    12 posts
    Member since:
    Feb 2011

    Posted 10 Aug 2012 Link to this post

    Thank you very much Sven! 

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

    Cheers!
  9. Alan
    Alan avatar
    29 posts
    Member since:
    Feb 2008

    Posted 20 Aug 2012 Link to this post

    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?
Back to Top
DevCraft banner