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

Calling FireCommandEvent to remove filtering on multiple columns

3 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohan
Top achievements
Rank 1
Mohan asked on 25 Nov 2009, 03:01 AM
Hi,

I have country and city column in the radgrid and I have defined a template filters using radcombobox for both the columns. I am able to filter on both columns.

The only problem I have is when removing filtering.

Say I have filtered on both Country and city column and then I select All in the Country Filter column. 
In the country combo selectedindexchanged event I am clearing the filtering using the following command

filterItem.FireCommandEvent("Filter"new Pair("NoFilter""Country")); 

The problem is that the filtering on the city column is still active. So i modified the above code to this

filterItem.FireCommandEvent("Filter"new Pair("NoFilter""Country")); 
filterItem.FireCommandEvent("Filter"new Pair("NoFilter""City")); 

THe above code does not work. The FireCommandEvent works only for the first line, not for the second. I tried switching the statement order.  Is it possible to remove filtering on multiple columns by calling FireCommandEvent multiple times.

Thanks

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 27 Nov 2009, 12:11 PM
Hello Mohan,

More straight-forward approach would be to clear the FilterExpression of the grid and iterate through the grid columns to set their CurrentFilterValue to an empty string. See the implementation of the btnShowAll's OnClick server handler on this demo for more details.

Kind regards,
Sebastian
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.
0
Mark
Top achievements
Rank 1
answered on 22 Jun 2012, 04:52 PM
would this work if you filter for both City and Country as the same time?  Or will the last command overwrite all previous filters?

filterItem.FireCommandEvent("Filter"new Pair("Contains""Country")); 
filterItem.FireCommandEvent("Filter"new Pair("Contains""City")); 

Thanks

Mark
0
Pavlina
Telerik team
answered on 27 Jun 2012, 08:33 PM
Hi Mark,

Indeed FireCommandEvent will fire for only one column in your case. In order to achieve the desired functionality you could try building custom filter expression which filters by two data fields.
All filter function you could find in the following online documentation article:
http://www.telerik.com/help/aspnet-ajax/grid-operate-with-filter-expression-manually.html

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Mohan
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Mark
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or