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

RadGridView filter using wildcards

9 Answers 171 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michal Zámec
Top achievements
Rank 2
Michal Zámec asked on 03 Jun 2011, 02:26 PM
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

9 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 05 Jun 2011, 09:27 AM
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

0
Michal Zámec
Top achievements
Rank 2
answered on 06 Jun 2011, 09:49 AM
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?
0
Emanuel Varga
Top achievements
Rank 1
answered on 06 Jun 2011, 10:00 AM
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
0
Michal Zámec
Top achievements
Rank 2
answered on 06 Jun 2011, 11:34 AM
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.
0
Martin Vasilev
Telerik team
answered on 09 Jun 2011, 08:54 AM
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.
0
K
Top achievements
Rank 1
answered on 22 Jan 2018, 12:41 PM
How is the current status in this case? Is there any possibility to filter strings with wildcards now ? :)
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Jan 2018, 09:29 AM
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.
0
TECNICA
Top achievements
Rank 1
answered on 28 Mar 2018, 05:39 PM

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

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Mar 2018, 11:48 AM
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.
Tags
GridView
Asked by
Michal Zámec
Top achievements
Rank 2
Answers by
Emanuel Varga
Top achievements
Rank 1
Michal Zámec
Top achievements
Rank 2
Martin Vasilev
Telerik team
K
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
TECNICA
Top achievements
Rank 1
Share this question
or