We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Restore filter settings on page load

Thread ID:





114396 Nov 18,2013 02:52 PM UTC Mar 5,2018 04:26 PM UTC ASP.NET MVC (Classic) 3
Tags: Grid
Mirko Pozzetti
Asked On November 18, 2013 02:52 PM UTC

I would like to restore the saved filters of the grid during the last visit on the page. I would like to know how to save and restore the settings on server side.
Thank you very much for your help,

Prabhu Sarvesan [Syncfusion]
Replied On November 19, 2013 12:05 PM UTC

Hi Mirko,

Thanks for your interest in Syncfusion product.

We would like to let you know that your requirement “Restore filter settings on page load” has been achieved on the server side. To achieve your requirement use Filter Descriptor values to restore filter settings on page load. To maintain paging, Sorting and other grid functionality use session concepts. The code snippets is shown below,

Code Snippet:


public class HomeController : Controller


   public ActionResult Index()


            if (Session["Args"] != null)


                List<AutoFormatting> data1 = new List<AutoFormatting>();

                var arg = (List<FilterDescriptor>)Session["Args"];

                for (int i = 0; i < arg.Count; i++)


                    var col = arg[i].ColumnName;

                    var val = arg[i].Value.ToString();

List<AutoFormatting> data =                                  (List<AutoFormatting>)AutoformatRepository.GetData();

                    foreach(var dat in data)


 if ( dat.Currency.ToString()==val.ToString() || dat.Dates.ToString() ==  val.ToString() || dat.Number.ToString() == val.ToString() || dat.Telephone.ToString() == val.ToString())






                Session["Data"] = data1;

                return View(data1);


            var data2 = AutoformatRepository.GetData();

            return View(data2);




        public ActionResult Index(PagingParams args)


            if (args.FilterDescriptors.Count != 0)


                Session["Args"] = args.FilterDescriptors;


            if (Session["Data"] != null)


                List<AutoFormatting> data1 = (List<AutoFormatting>)Session["Data"];

                Session["Data"] = data1;

                return data1.GridActions<AutoFormatting>();


            IEnumerable data = AutoformatRepository.GetData();

            return data.GridActions<AutoFormatting>();





For your convenience we have created a sample and the same can be download from the below attachment.

Please let us know if you need any further assistance.


Prabhu Sarvesan


Aditi Patre
Replied On March 1, 2018 02:06 PM UTC

Can we retain the filter settings on page size settings change ? (Dropdown displays the page-size).

Isuriya Rajan [Syncfusion]
Replied On March 5, 2018 04:26 PM UTC

Hi Aditi, 
Thanks for contacting Syncfusion support, 
Please refer the below KB for your requirement. 
Please get back to us if you need any other assistance. 
Isuriya R 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon