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

Hiding the Filter at Page Load

3 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael O'Flaherty
Top achievements
Rank 2
Michael O'Flaherty asked on 06 Mar 2013, 07:20 PM
Hi!

This may be obvious but I am missing it. I created a button in the CommandItemTemplate to toggle the filter. It is in javascript and works fine. However, I would prefer to display the grid with the filter hidden from the start. Is there a property in the aspx definition or in the code behind that can set that?

Using CSS seems to hide it permantly:
.radGrid .rgFilterRow
{
    display: none !important;
}

Thanks for your help!
Michael

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Mar 2013, 04:21 AM
Hi,

Try the following code.
C#:
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
        if (e.Item is GridFilteringItem)
        {
            GridFilteringItem item = (GridFilteringItem)e.Item;
            item.Visible = false;
        }
}

Thanks,
Shinu
0
Michael O'Flaherty
Top achievements
Rank 2
answered on 07 Mar 2013, 01:59 PM
Thanks for the reply! Unfortunately, this seems to have the same effect as the CSS -- it hides the filter on every postback. We would like to be able to toggle the setting. Do we have to manage this ourselves? Is there some way to initially hide it in the radGrid_Init event?
0
Michael O'Flaherty
Top achievements
Rank 2
answered on 07 Mar 2013, 08:20 PM
This seems to work for me. Thanks again for your help!

protected void radGridReferrals_Init(object sender, EventArgs e)
{
     RadGrid radGrid = (RadGrid)sender;
     radGrid.MasterTableView.IsFilterItemExpanded = false;
}
Tags
Grid
Asked by
Michael O'Flaherty
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Michael O'Flaherty
Top achievements
Rank 2
Share this question
or