Determine from which column a filter was selected

2 posts, 0 answers
  1. John
    John avatar
    9 posts
    Member since:
    May 2019

    Posted 24 May 2019 Link to this post

    I thought this would be a simple task. So, apparently I'm either missing something or it is not so easy.
    I would like to utilize the filter menu not to filter existing data, but rather as a means to select a value to populate all the cells of that column.
    I can do this easily with separate dropdownlists positioned above the grid header. But to me, this looks clunky so I want to utilize the filter menu.

    I have several columns that require the same functionality.
    I.e the cells are initially empty or set to some other value. I would like to fill them with the value selected in the filter. In one case, the cells are actually dropdownlists. Neither the filter menu items nor the column values are data bound.
    I created a custom filter with custom filter menu items. I simply want to determine for which column the filter was selected so I can then perform the code which fills in the cells with the selected value.

    In the Page_Init() I create the custom menu items and add an .ItemClick handler.
    When I select an item from the filter menu the ItemClick is fires as expected.
    I can get the selected value from e.Item.Value from the RadMenuEventArgs e paremeter. However, I’ve searched for an hour and I can’t find anywhere in the RadMenuEventArgs e or object sender  parameter to determine from which column the ItemClick was fired.

  2. Attila Antal
    Admin
    Attila Antal avatar
    440 posts

    Posted 29 May 2019 Link to this post

    Hi John,

    From your description I am not sure whether the Classic filtering is used or Excel-Like filtering, however, there is a good way to understand which columns has filtering applied. Please take a look at the following Code Library sample that uses Excel-Like filtering demonstrating how to Visually indicate filtered columns in RadGrid with Excel-Like Filtering.

    Even, if your scenario does not use neither the Classic or Excel-Like filtering, the approach from the Sample is the way to understand if a column has filtering applied.

    I hope this will prove helpful.

    Kind regards,
    Attila Antal
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top