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

Questions regarding custom filtering

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 09 Mar 2009, 02:15 PM
Hi!

I am trying to implement custom filtering in my application, during my Implementation a few things are not clear to me, so i hope somebody explain me these thing.

I tred to add several Custom Filtering Options like this

GridFilterMenu filterMenu = MaintenanceGrid.FilterMenu; 
RadMenuItem menuItem = new RadMenuItem("Valid""Contains"); 
filterMenu.Items.Add(menuItem); 

but none of these options are displayed in my list, only one option is displayed with the name custom.

How can i add more then one custom filtering option in the menu?

Then i tried to get it running with this sinlge option, but in the itemCommand Fired Event i got a Parse Exception, i checked my filter expression but i cannot find any error.

Here is the code of the EventHandler

if (filterPair.First.ToString().Equals("Custom")) 
string columName = filterPair.Second.ToString(); 
TextBox tbPattern = (e.Item as GridFilteringItem)[columName].Controls[0] as  TextBox; 
string[] values = tbPattern.Text.Split(' '); 
 
// string newFilter = "(([" + filterPair.Second + "] ='" + values[0] + "') AND ([" + filterPair.Second + "] ='" + values[1] + "'))"; 
string newFilter = "(([" + filterPair.Second + "] ='" + values[0] + "'))"
if (MaintenanceGrid.MasterTableView.FilterExpression == ""
MaintenanceGrid.MasterTableView.FilterExpression = newFilter; 
else 
MaintenanceGrid.MasterTableView.FilterExpression = "((" + 
MaintenanceGrid.MasterTableView.FilterExpression + ") AND (" + newFilter + "))"
MaintenanceGrid.Rebind(); 

The exception occurs when Rebind is called, what problem can cause this exception?

Is it possible that the FilterPair.first value is the name of the CustomFilter?

Regards,
Martin

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 11 Mar 2009, 02:43 PM
Hi Martin,

The question set forth has been answered in the support ticket that you opened on the matter. To avoid duplicate posts, we can continue our communication there.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Roland
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or