This is a migrated thread and some comments may be shown as answers.

Channel execution of filter through single button click

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 06 Apr 2011, 08:31 PM
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?

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 08 Apr 2011, 11:50 AM
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,
Tsvetina
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
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or