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

Filter menu shows only "Contains" .

5 Answers 334 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prajakta
Top achievements
Rank 1
Prajakta asked on 11 Aug 2011, 11:44 AM
Hi,

I am using rad grid for which filter menu option is used. Some of the filter menus are removed for customization like Greater than, Less Than, etc.

The problem is when I type something in Filter box and click on filter button all menus are shown. Then I select "Contains" from it.
The grid shows me filtered records. After that  I select "No Filter" and all records are shown. After that again I click on filter menu and only "Contains" option is shown in Filter menu. Why so..? Is there any problem with Filter menu or please tell me its working.

I am using the latest version of telerik  Rad controls i.e. 2011.2.712.35

Please help me out with this. Its urgent.


Thanks.

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Aug 2011, 11:52 AM
Hello Prajakta,

Check the following help documentation which explains how to customize filter menu.
Reducing the Filter Menu Options.

Thanks,
Princy.
0
Prajakta
Top achievements
Rank 1
answered on 11 Aug 2011, 01:37 PM
My problem is not for removing Filter menus. Its like after filtering once or twice all the menu items are not shown only contains is shown in Filter menu. Please follow steps below. This problem did not occur in previous version of 2008.

The problem is when I type something in Filter box and click on filter button all menus are shown. Then I select "Contains" from it.
The grid shows me filtered records. After that  I select "No Filter" and all records are shown. After that again I click on filter menu and only "Contains" option is shown in Filter menu. Why so..? Is there any problem with Filter menu or please tell me its working.

I am using the latest version of telerik  Rad controls i.e. 2011.2.712.35

Please help me out with this. Its urgent.
0
Mira
Telerik team
answered on 16 Aug 2011, 04:04 PM
Hello Prajakta,

Could you please send the code you use for reducing the filter menu options?
I will examine it locally and get back to you with my findings.

I am looking forward to your reply.

Kind regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Prajakta
Top achievements
Rank 1
answered on 17 Aug 2011, 08:25 AM
The code to remove filter menus.

private void RemoveFilterMenuItemFromGrid()
        {
            GridFilterMenu menu = radGridReferences.FilterMenu;
            int i = 0;
            while (i < menu.Items.Count)
            {
                if (menu.Items[i].Text == "NoFilter" ||
                   menu.Items[i].Text == "Contains" ||
                   menu.Items[i].Text == "EqualTo" ||
                   menu.Items[i].Text == "DoesNotContain" ||
                   menu.Items[i].Text == "StartsWith" ||
                    menu.Items[i].Text == "EndsWith" ||
                    menu.Items[i].Text == "NotEqualTo" ||
                    menu.Items[i].Text == "IsEmpty" ||
                    menu.Items[i].Text == "NotIsEmpty" ||
                    menu.Items[i].Text == "IsNull" ||
                    menu.Items[i].Text == "NotIsNull")
                {
                    i++;
                }
                else
                {
                    menu.Items.RemoveAt(i);
                }
            }
        }


I have called this code on NeedDataSource event of this grid.
After that I have added code to rename the filter menus in same event.

private void RenameFilterMenu()
        {
            GridFilterMenu menu = radGridReferences.FilterMenu;
            foreach (RadMenuItem item in menu.Items)
            {    //change the text for the "StartsWith" menu item 
                switch (item.Text)
                {
                    case "NoFilter":
                        item.Text = "No Filter";
                        break;
                    case "DoesNotContain":
                        item.Text = "Does Not Contain";
                        break;
                    case "StartsWith":
                        item.Text = "Starts With";
                        break;
                    case "EndsWith":
                        item.Text = "Ends With";
                        break;
                    case "EqualTo":
                        item.Text = "Equal To";
                        break;
                    case "NotEqualTo":
                        item.Text = "Not Equal To";
                        break;
                    case "GreaterThan":
                        item.Text = "Greater Than";
                        break;
                    case "LessThan":
                        item.Text = "Less Than";
                        break;
                    case "GreaterThanOrEqualTo":
                        item.Text = "Greater Than Or Equal To";
                        break;
                    case "LessThanOrEqualTo":
                        item.Text = "Less Than Or Equal To";
                        break;
                    case "NotBetween":
                        item.Text = "Not Between";
                        break;
                    case "IsEmpty":
                        item.Text = "Is Empty";
                        break;
                    case "NotIsEmpty":
                        item.Text = "Not Is Empty";
                        break;
                    case "IsNull":
                        item.Text = "Is Null";
                        break;
                    case "NotIsNull":
                        item.Text = "Not Is Null";
                        break;
                    default:
                        break;
 
                }
            }
        }
0
Mira
Telerik team
answered on 22 Aug 2011, 08:27 AM
Hello Prajakta,

I suggest that you move the code for hiding the menu items in the grid's Init event as it is described in the Reducing the Filter Menu Options help topic. Please use the Page_Load event to change the text of the items.

I hope this helps.

Best wishes,
Mira
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Prajakta
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Prajakta
Top achievements
Rank 1
Mira
Telerik team
Share this question
or