Custom Filter Text

4 posts, 2 answers
  1. Lovella Bacaud
    Lovella Bacaud avatar
    20 posts
    Member since:
    Apr 2013

    Posted 03 Apr 2013 Link to this post

    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
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Apr 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lovella Bacaud
    Lovella Bacaud avatar
    20 posts
    Member since:
    Apr 2013

    Posted 04 Apr 2013 Link to this post

    Thankyou princy. That issue is sorted out. What if I want to hide all the other filters other than the custom one I set?
  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Apr 2013 Link to this post

    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;
        }
    }
Back to Top