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

Save Filter Expression hierarchical

2 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Francis
Top achievements
Rank 1
Francis asked on 18 Sep 2008, 03:12 PM

Hi,

 I would like to save the filter expressions and the sort expressions of my detail tables in my RadGrid so I could reload them when I come back to the page.

 I use SqlDataSource and this :
 http://www.telerik.com/help/aspnet/grid/grdsavingsettingsonperuserbasis.html

It's working for my MasterTableView but when I'm looking for my detailTables :
gridInstance.MasterTableView.DetailTables(0).FilterExpression it has no value (but the filtering of the detailTables is working)

I would like to know where the can I get the filter expression of my DetailTables so I can save it.

Thanks
Francis

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Sep 2008, 11:51 AM
Hello Francis,

You can try out the following code to access the FilterExpression of the DetailTable.
cs:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) 
        { 
            if (dataItem.Expanded) 
            { 
               GridTableView nestedView = (GridTableView)dataItem.ChildItem.NestedTableViews[0];               
               string filterExp = nestedView.FilterExpression.ToString();               
            } 
        } 
   } 

Princy.
0
Francis
Top achievements
Rank 1
answered on 19 Sep 2008, 06:06 PM
Thanks Princy,

Now I can save the filter expression, but I guess the real challenge is to load it...

When I try to access my grid in the Init event of my page, there's no data in my grid so I can't "restore" the filter expression of my detail tables the same way I did it to save the expression
Even if I try to set it directly with something like :
gridInstance.MasterTableView.DetailTables(0).FilterExpression = "([NomNiveau] LIKE '%Di%)"
it doesn't work either.

Thanks

Francis
Tags
Grid
Asked by
Francis
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Francis
Top achievements
Rank 1
Share this question
or