Channel execution of filter through single button click

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 06 Apr 2011 Link to this post

    I have a grid with AllowFilteringByColumn="true", filtering on all columns is enabled and AutoPostBackOnFilter="false" for all columns. What I would like to do is only apply the filter when a user clicks a button either in a custom CommandTemplate or outside the grid (either one will work fine). There are two problems that are stopping me:

    1. How do I fire the filtering from code-behind? I know I can do it client-side but...
    2. Any column that has the filter icon will fire the filtering on selecting a value.

    If I can do #1, then I can disable the grid's filtering client-side and fire the filtering using the button's click event. If I cannot fire the filtering in code-behind, then is there a way of disabling the firing of a postback on choosing one of the filter choices?
  2. Tsvetina
    Tsvetina avatar
    1861 posts

    Posted 08 Apr 2011 Link to this post

    Hello Thomas,

    I answered these questions in the formal support ticket that you have opened. Again posting the answer here for others to see, but if you have any further concerns, let us continue posting in the formal support thread, so that we avoid duplicate posts. Thank you in advance for your understanding.

    You can fire any grid command in code-behind by using the FireCommandEvent() method. In the specific case with filtering, you would need to get hold of the GridFilteringItem and fire the command upon it. More information is available at that address.

    Or if you want to capture the Filter command on the client to cancel it on some condition (like checking the command argument) you can wire the client OnCommand event which is fired for each command before it gets executed (in this case through a postback).

    Best wishes,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top