RadGridView filter using wildcards

10 posts, 1 answers
  1. Michal Zámec
    Michal Zámec avatar
    5 posts
    Member since:
    May 2010

    Posted 03 Jun 2011 Link to this post

    Hi,

    I'm trying to use FilterDescriptors.Expression in radgrid, but everytime i put any wildcard here, it always wraps that wildcard into brackets (name like 'a%' became name like 'a[%]') and grid gets fully filtered, because there is no matching line. I've tried diferent types of wildcards (*, %, ?) but it always gets me the same result. Am I missing something? 

    Thanks
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 05 Jun 2011 Link to this post

    Hello,

    Please take a look at the documentation for filters here (simple or composite).

    If i understood correcly and you are adding filters programmaticaly you should just specify the Operator corresponding to your required filter, possible operator values are : IsLike, IsNotLike, IsLessThan, IsLessThanOrEqualTo, IsEqualTo, IsNotEqualTo, IsGreaterThanOrEqualTo, IsGreaterThan, StartsWith, EndsWith, Contains, NotContains, IsNull,  IsNotNull, IsContainedIn, IsNotContainedIn.

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP

  3. Michal Zámec
    Michal Zámec avatar
    5 posts
    Member since:
    May 2010

    Posted 06 Jun 2011 Link to this post

    I've already tried FilterDescriptors, but the behavior was the same. Every wildcard inserted in text (value) was escaped and wrapped into brackets []. Then I tried to use that FilterDescriptors.Expression in order to bypass that behavior, but no success at all. I just need to somehow tell the grid to filter for example: name like 'ab%cd%'

    Any ideas?
  4. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 06 Jun 2011 Link to this post

    Hello again,

    Ok, maybe i was not clear enough, the only way to do this is to create a composite filter, for your case you will need something like this:
    CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.StartsWith, "ab"));
    compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.Contains, "cd"));
    compositeFilter.LogicalOperator = FilterLogicalOperator.And;
    this.radGridView1.FilterDescriptors.Add(compositeFilter);

    So here, you want all the Name's starting with ab (ab%) AND all names containing cd (%cd%) right?

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP
  5. Michal Zámec
    Michal Zámec avatar
    5 posts
    Member since:
    May 2010

    Posted 06 Jun 2011 Link to this post

    So there is no way, I can put wildcards into radgrid filtering? Composite descriptors will work in most cases, but they'll fail for something like this: name like '%ab%cd%'. By using FIlterDescriptors (contains('ab') AND contains('cd')), its not desired behavior ('abcd' is ok, but 'cdab' will also pass that condition, which is wrong)

    EDIT: If I get it right, FilterDescriptors.IsLike and FilterDescriptors.IsNotLike does not work/is not implemented yet? Because those descriptors should be exactly what i need, but still, they wont accept wildcards.
  6. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 09 Jun 2011 Link to this post

    Hello Michal,

    Thank you for writing.

    Unfortunately, we do not support specifying a wildcard character in the filter criteria even if the Like operator is used. The wildcard is always escaped and there is not an elegant work-around for the situation. We will consider improving this functionality for one of the next releases.

    Let me know if you have any other questions.

    Best wishes,
    Martin Vasilev
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  7. K
    K avatar
    7 posts
    Member since:
    Jan 2018

    Posted 22 Jan 2018 Link to this post

    How is the current status in this case? Is there any possibility to filter strings with wildcards now ? :)
  8. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 23 Jan 2018 Link to this post

    Hello,

    Thank you for writing.  

    RadGridView is not designed to support wildcard filters out of the box. However, it offers custom filtering mechanism where the user is allowed to filter the grid rows by custom criteria. You have the opportunity to determine whether a row is visible or not in the CustomFiltering event. Additional information is available here: http://docs.telerik.com/devtools/winforms/gridview/filtering/custom-filtering

    You can refer to our Demo application >> GridView >> Custom Filtering or Custom Filter Row examples which demonstrate sample approaches.

    I hope this information helps. Should you have further questions I would be glad to help. 
     
     Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  9. TECNICA
    TECNICA avatar
    1 posts
    Member since:
    Dec 2017

    Posted 28 Mar 2018 Link to this post

    I need this type of filter with wildcards in radgridview

    https://www.codeproject.com/articles/611078/asp-net-mvc-grid-wildcard-filtering-like-operator

    Please, is urgent

  10. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 30 Mar 2018 Link to this post

    Hello,   

    By design, RadGridView doesn't support wildcard filtering–like operator. However, RadGridView offers custom filtering which may be suitable for your case. It is a flexible mechanism for filtering RadGridView rows by using custom logic. It has a higher priority than the applied FilterDescriptors (added either by code or using the filtering row). Please refer to the following help article: https://docs.telerik.com/devtools/winforms/gridview/filtering/custom-filtering

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top