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

Grid filtering

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Regeesh Joseph
Top achievements
Rank 1
Regeesh Joseph asked on 06 Aug 2010, 09:33 AM
Hai,

How the grid filtering is working? On which property, the filter text is saving? I want to assign filter text through code behind.

Plz help.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Aug 2010, 12:47 PM
Hello Rageesh,

To enable or disable filtering, set the AllowFilteringByColumn property of the RadGrid or GridTableView control.

RadGrid filters data internally, after data binding. Filtering can be fully customized by setting the value of FilterExpression property of the GridTableView control. If you want to work with FilterExpression of Telerik RadGrid manually, then the following documentation will be of help:
Operating with the FilterExpression of Telerik RadGrid manually

Setting the text for filter textbox is nearly simple; access the GridFilteringItem from code behind and get reference to the textbox control to set the Text property. The follwoing code snippet will be helpful.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       GridFilteringItem filterItem = (GridFilteringItem)RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0];
       TextBox txt = (TextBox)filterItem["ColumnUniqueName"].Controls[0];// Access the control
       txt.Text = "Ja";
   }

Thanks,
Princy.
Tags
Grid
Asked by
Regeesh Joseph
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or