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

Filtering columns in GridView with special operands

1 Answer 26 Views
GridView
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 11 Jan 2021, 01:05 PM

Hello,

We are currently looking for a way to extend the RadGridView with the ability to search using boolean and comparison operators. Our gridview is bound to a list that is filled with data from our database according to the search text (e.g. for a number field "<100 & >50"). In principle, this works without any problems.

However, the GridView then performs another search in the code, corresponding to a column for the same search text. This logically leads to an empty list, as the search text does not apply to a number field, but we have not yet found a way to bypass the code-based search without also deactivating the search headers etc.

Our question is accordingly at this point:
Is there a way to deactivate the search in the code?
If not, is it possible to bypass it in another way - for example by removing the binding of the search text box and manually searching through a "KeyDown Event"?

Many thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 14 Jan 2021, 09:21 AM

Hello,

Although I'm not sure I fully understood your scenario and requirement, I believe you can handle the Searching event of the control, cancel it, and perform your custom filtering.

private void RadGridView_Searching(object sender, Telerik.Windows.Controls.GridView.GridViewSearchingEventArgs e) 
{ 
    if (e.SearchText.ToString() == "SomeText") 
    { 
        e.Cancel = true; 
    } 
} 
Can you please let me know if such an approach would work for you or if I have misunderstood your requirement in any way?

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
n/a
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or