Custom GridView Filter Popup

4 posts, 1 answers
  1. Hugo Furth
    Hugo Furth avatar
    31 posts
    Member since:
    Dec 2008

    Posted 26 May 2014 Link to this post

    Hi All -

    I looked thru the forum but could find an example of what I need to do. And that is

    empty the filter popup and populate it with my own entries.

    For simplicity I only need 3 fields. The underlying column will contain only "A", "B", or blank/null so I would like the popup 
    to contain only those values. Even if the column could contain "C" or "D", I don't want to filter on that.

    I know this can't be too difficult but I was unable to find an example and the code I wrote didn't work properly.

    Any help appreciated.
    Regards,
    Hugo
  2. Hugo Furth
    Hugo Furth avatar
    31 posts
    Member since:
    Dec 2008

    Posted 26 May 2014 Link to this post

    Forgot.....also need an "All" selection.

    Thx,
    Hugo
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 28 May 2014 Link to this post

    Hi Hugo,

    Thank you for writing.

    The FilterPopupInitialized event can be used for both, to remove any items you want and to change the items in the treeview:
    void radGridView1_FilterPopupInitialized(object sender, Telerik.WinControls.UI.FilterPopupInitializedEventArgs e)
    {
        RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup;
        if (popup != null)
        {
            popup.MenuElement.Items.RemoveAt(0);
            popup.MenuElement.Items.RemoveAt(0);
             
            popup.MenuTreeElement.DistinctListValues.Add("<empty>", "");
            popup.MenuTreeElement.DistinctListValues.Remove("C");
            popup.MenuTreeElement.DistinctListValues.Remove("D");
        }
    }

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  5. Hugo Furth
    Hugo Furth avatar
    31 posts
    Member since:
    Dec 2008

    Posted 08 Jun 2014 Link to this post

    Your answer greatly appreciated.

    Hugo
Back to Top