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

Show/Hide filtering item

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 01 Aug 2011, 05:43 PM
Hello,

I am new to Telerik RadGrid.How can I show or hide filtering item based on some conditions?Can you provid any working sample?

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 01 Aug 2011, 06:31 PM
hi,

There are two ways to achieve this thing.
Method 1:
 
private void RadGrid1_ColumnCreated(object sender, Telerik.WebControls.GridColumnCreatedEventArgs e)
{
  if(e.Column.UniqueName == "ColumnUniqueName") // place here your column unique name
  {
   GridBoundColumn boundColumn = e.Column as GridBoundColumn;
   boundColumn.AllowFiltering= false;
  }
}

Method 2:
protected void RadGrid1_PreRender(object sender, System.EventArgs e)
{
       foreach(GridColumn column in RadGrid1.Columns)
            if (column.UniqueName == "ColumnUniqueName")
           {
               (column as GridBoundColumn).AllowFiltering= false;
           }
       }
       RadGrid1.Rebind();
}


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Tina
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or