Enable filtering in the grid embedded in RadFileExplorer

4 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1679 posts
    Member since:
    Oct 2004

    Posted 03 Dec 2009 Link to this post

    Requirements

    RadControls version ASP.NET AJAX 2009
    .NET version .NET 3.5
    Visual Studio version   2008
    programming language C# / JavaScript
    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    This example shows how to enable filtering in the grid embedded in RadFileExplorer.

    NOTES
    This feature is offered out of the box since Q1 2011. You can see it in action in this online demo.

    THE RESULT




  2. Philip
    Philip avatar
    21 posts
    Member since:
    Nov 2008

    Posted 22 Dec 2010 Link to this post

    Thanks! Another question, using the code mentioned, how you set filtering to disregard case-sensitivity? I tried adding the line:

    RadFileExplorer1.Grid.GroupingSettings.CaseSensitive = false;

    on page load but it doesn't work.
  3. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 27 Dec 2010 Link to this post

    Hi Philip,

    The actual filtering is performed manually in the ExplorerPopulated event and you need to implement case insensitive comparison manually. An example implementation is to pass a second parameter StringComparison.InvariantCultureIgnoreCase to the comparison methods. The required changes are highlighted in the code snipped bellow:
    switch (gridKnownFunction)
    {
        case GridKnownFunction.StartsWith:
            {
                e.List = e.List.FindAll(fi => fi.Name.StartsWith(filterText, StringComparison.InvariantCultureIgnoreCase)).ToList();
            }; break;
        case GridKnownFunction.EndsWith:
            {
                e.List = e.List.FindAll(fi => fi.Name.EndsWith(filterText, StringComparison.InvariantCultureIgnoreCase)).ToList();
            }; break;
        case GridKnownFunction.Contains:
            {
                e.List = e.List.FindAll(fi => fi.Name.ToLower().Contains(filterText.ToLower())).ToList();
            }; break;
    }


    Kind regards,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  4. Philip
    Philip avatar
    21 posts
    Member since:
    Nov 2008

    Posted 27 Dec 2010 Link to this post

    It works now. Thanks!
Back to Top