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

Setting Filter on ItemCreated

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Klein
Top achievements
Rank 1
Eric Klein asked on 12 Apr 2010, 07:18 PM
I have the following code
protected void RadGrid2_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)  
        {  
            if (e.Item is GridFilteringItem)  
            {  
                RadGrid2.MasterTableView.FilterExpression = "([Active] = true) ";  
                GridColumn column = RadGrid2.MasterTableView.GetColumnSafe("Active");  
                column.CurrentFilterFunction = GridKnownFunction.EqualTo;  
                column.CurrentFilterValue = "True";  
            }  
        } 

I then later in jave script use
nestedView.get_filterExpressions().toDynamicLinq()  
 
to get the current filter.  The problem is when I hit this line of code It cliams the filter if blank.  Am I missing something?

Just some more backgroud.  This is happening in a nested grid taht is nested by use of panels.  The ItemCreated is running when the page loads, then when the use selects a record from RadGrid1 it runs a webservice that getst the data then in java script updates the nested grid.

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 15 Apr 2010, 03:38 PM
Hello Eric,

You can use the grid's PreRender event to specify an initial filter. Note that after setting the filter, you must rebind the grid: For more information, please refer to the help topic below:
Applying default filter on initial load

Additionally, I suggest you review the following help article:
Operating with the FilterExpression of Telerik RadGrid manually

Kind regards,
Pavlina
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.
Tags
Grid
Asked by
Eric Klein
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or