Setting Filter on ItemCreated

2 posts, 1 answers
  1. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 12 Apr 2010 Link to this post

    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
    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.
  2. Answer
    Pavlina avatar
    6166 posts

    Posted 15 Apr 2010 Link to this post

    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,
    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.
Back to Top