Hide Filter for some columns

11 posts, 0 answers
  1. Omesis
    Omesis avatar
    3 posts
    Member since:
    May 2008

    Posted 02 Jun 2008 Link to this post

    Hi I'm using a RadGridView, i want use a filter but not for all columns, how can i hide this for someone columns? Thanks
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 03 Jun 2008 Link to this post

    Hi Alejandro,

    Currently, showing and hiding the filtering editor box for separate columns is not supported by RadGridView. We will consider implementing this feature in one of our upcoming releases.

    If you have additional questions, do not hesitate to contact me.

    Regards,
    Nikolay
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. luca
    luca avatar
    9 posts
    Member since:
    Feb 2008

    Posted 02 Feb 2010 Link to this post

    i've the same problem. on ver. 2009 Q3, there is a solution?

    Thanks
  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 05 Feb 2010 Link to this post

    Hi luca,

    We introduced the ViewCellFormatting event which allows you to modify the non-data cells of RadGridView. So, in order to hide the filtering cells for some columns, you can use the following code pattern:
    void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {            
        if (e.CellElement is GridFilterCellElement)
        {               
            // sample condition
            if (e.CellElement.ColumnInfo is GridViewTextBoxColumn)
            {
                e.CellElement.Visibility = ElementVisibility.Collapsed;
            }
        }
    }


    If you have additional questions, feel free to contact me.

    Best wishes,
    Nikolay
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  6. Basel Nimer
    Basel Nimer avatar
    94 posts
    Member since:
    Oct 2009

    Posted 23 Apr 2010 Link to this post

    I do :)

    i need to be able to remove some of the filters that appear, and add some others.

    the idea is, i have a date (actually, i am saving that as an interger in the database, but doing formatting before binding), but i want to be able to let the user choose Today, or this WEEK to filter this columns, and that's it, no contains, no startswith, nothing more., how can i control that?

  7. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 03 May 2010 Link to this post

    Hello Basel Nimer,

    You can modify the default filtering context menu by handling the ContextMenuOpening event:
    http://www.telerik.com/help/winforms/modifying_existing_context_menu.html

    Depending on your scenario, you also may need to prevent the user from entering a value in the filtering cell:
    private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
        if (this.radGridView1.CurrentRow is GridViewFilteringRowInfo)
        {
            if (((Telerik.WinControls.UI.GridViewDataColumn)this.radGridView1.CurrentColumn).FieldName == "HireDate")
            {
                e.Cancel = true;
            }
        }
    }

    Last, but not least, you should customize the filtering behavior on Click of the custom filerting menu items. To do this, you need to handle the CustomFiltering event. I am attaching a sample project that demonstrates the full approach.

    If you need additional assistance, feel free to contact me.

    Sincerely yours,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  8. jprian
    jprian avatar
    43 posts
    Member since:
    Sep 2006

    Posted 29 Jul 2011 Link to this post

    Hi,
    we are having one problem with this solution. If you select one data row and then click on filter icon, if you try
    if (this.radGridView1.CurrentRow is GridViewFilteringRowInfo)

    you get currentrow type is not GridViewFilteringRowInfo else GridViewDataRowInfo.
    So you need before select row filter.
    Is there other solution to get row type parent of ContextMenu?

    Thanks
  9. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 03 Aug 2011 Link to this post

    Hello Jesus,

    Thank you for pointing this out.

    I have updated my project to work with the latest RadGridView API. The issue in question is also addressed there and you do not need to click on the filtering row in order to get the custom filter menu.

    I hope this helps.

    Kind regards,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
  10. jprian
    jprian avatar
    43 posts
    Member since:
    Sep 2006

    Posted 15 Aug 2011 Link to this post

    Hello Nikolay, I guess that I didn't explain myself clearly. The issue is when I open context menu with right click on row filter I can't distinguish if click is on filter row or data row to show one or another menu option.
    Thanks
  11. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 16 Aug 2011 Link to this post

    Hello Jprian,

    Thank you for clarifying your requirement.

    You can determine if you have right-clicked on a filter cell by checking the type of the ContextMenuProvider as in the example below:

    void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
           {
               if (e.ContextMenuProvider is GridFilterCellElement)
               {
                   // TO DO
                   e.ContextMenu.Items.RemoveAt(0);
                   e.ContextMenu.Items.RemoveAt(0);
                   return;
               }
           }

    I hope this helps.

    All the best,
    Nikolay
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  12. jprian
    jprian avatar
    43 posts
    Member since:
    Sep 2006

    Posted 16 Aug 2011 Link to this post

    Thanks Nicolay, your suggestion works perfectly.

    Thanks again.
Back to Top
UI for WinForms is Visual Studio 2017 Ready