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

[Solved] RadGrid Control and Filtering in postback

1 Answer 278 Views
Grid
This is a migrated thread and some comments may be shown as answers.
maryam sh
Top achievements
Rank 1
maryam sh asked on 18 Aug 2009, 10:26 PM
Hi

I am using a RadGrid control on my web page (search page) which allow user to filter columns. inside my RadGrid I have a link which redirects user to another page and user can back to the search page again.
I was wondering is there any way that I can store the RadGrid's filter condition in a place like session and restore all of them when user is back to visit the page.

I used the following code but it just returns the string ,it didn't set the filter column with their search value in RadGrid.

        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                if (Session["RadGridFilterConditions"] != null) 
                { 
                    RadGrid1.MasterTableView.FilterExpression = Session["RadGridFilterConditions"].ToString(); 
                    RadGrid1.DataBind(); 
                } 
            } 
        } 
        protected void Page_PreRender(object sender, EventArgs e) 
        { 
            Session["RadGridFilterConditions"] = RadGrid1.MasterTableView.FilterExpression; 
        } 

Thanks,

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Aug 2009, 07:51 AM
Hi Maryam,

I can see that you are calling DataBind() inside the PageLoad event. Try using Rebind() instead.  Also bind the Grid using AdvanceDataBinding techniques.
Advanced Data Binding

Shinu
Tags
Grid
Asked by
maryam sh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or