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

Custom Filter Text

3 Answers 56 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Lovella Bacaud
Top achievements
Rank 1
Lovella Bacaud asked on 04 Apr 2013, 02:57 AM
Hi,

There is a RadGrid in one of my pages with filtering enabled. Can I modify the predefined Filter Text like "Starts With" and give a custom one?

Thankyou,
Lovella

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 04 Apr 2013, 05:01 AM
Hi Lovella,

It is possible to give custom filter text. You can try the following sample code in the page load event.

C#:
GridFilterMenu menu = RadGrid1.FilterMenu;
foreach (RadMenuItem item in menu.Items)
{
    if (item.Text == "StartsWith")
    {
        item.Text = "YourCustomText";
    }
}

Thanks,
Princy.
0
Lovella Bacaud
Top achievements
Rank 1
answered on 04 Apr 2013, 04:35 PM
Thankyou princy. That issue is sorted out. What if I want to hide all the other filters other than the custom one I set?
0
Accepted
Princy
Top achievements
Rank 2
answered on 05 Apr 2013, 04:09 AM
Hi Lovella,

Simply add an else inside the foreach loop and set item visibility to false. Please check the following C# code.

C#:
GridFilterMenu menu = RadGrid1.FilterMenu;
foreach (RadMenuItem item in menu.Items)
{
    if (item.Text == "StartsWith")
    {
        item.Text = "Your Custom Text";
    }
    else
    {
        item.Visible = false;
    }
}
Tags
Filter
Asked by
Lovella Bacaud
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Lovella Bacaud
Top achievements
Rank 1
Share this question
or