Filtering columns in GridView with special operands

2 posts, 0 answers
  1. Dr Jan Wolf
    Dr Jan Wolf avatar
    1 posts
    Member since:
    Nov 2018

    Posted 11 Jan Link to this post

    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!

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1255 posts

    Posted 14 Jan Link to this post

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

Back to Top