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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set Default Filter on a Column for Excel-Type Filtering

Thread ID:





144084 Apr 17,2019 05:30 PM UTC Apr 19,2019 11:25 AM UTC ASP.NET Web Forms 3
Tags: Grid
Levi Leonards
Asked On April 17, 2019 05:30 PM UTC

Is there a way to set a Default Filter on a column in a Grid that uses Excel-Type Filtering when the page/grid is loaded?
Preferably in the backend code part (C# or VB).

For example: When the page is loaded, set a default filter for the "Product Type" Column where not equal to "Paper"

Vignesh Natarajan [Syncfusion]
Replied On April 18, 2019 08:55 AM UTC

Hi Levi,  
Thanks for contacting Syncfusion forums. 
Query: “When the page is loaded, set a default filter for the "Product Type" Column where not equal to "Paper" 
From your query, we understand that you need to define the filterSettings in the code behind. We have achieved your requirement by define the FilterSettings in the server side. Refer the below code example  
List<Orders> order = new List<Orders>(); 
        protected void Page_Load(object sender, EventArgs e) 
        private void BindDataSource() 
            int orderId = 10000; 
            int empId = 0; 
            for (int i = 1; i < 9; i++) 
                order.Add(new Orders(orderId + 1, "VINET", empId + 1, 32.38, "Reims", true)); 
                order.Add(new Orders(orderId + 2, "TOMSP", empId + 2, 11.61, "Munster", false)); 
                order.Add(new Orders(orderId + 3, "ANATER", empId + 3, 45.34, "Berlin", true)); 
                order.Add(new Orders(orderId + 4, "ALFKI", empId + 4, 37.28, "Mexico", false)); 
                order.Add(new Orders(orderId + 5, "FRGYE", empId + 5, 67.00, "Colchester", true)); 
                order.Add(new Orders(orderId + 6, "JGERT", empId + 6, 23.32, "Newyork", true)); 
                orderId += 6; 
                empId += 6; 
            this.OrdersGrid.DataSource = order; 
            this.OrdersGrid.Model.FilterSettings.FilteredColumns.Add(new Syncfusion.JavaScript.Models.FilteredColumn() { Field = "CustomerID", MatchCase = false, Operator = Syncfusion.JavaScript.FilterOperatorType.NotEquals, Predicate = "and", Value = "VINET" }); 
Refer the below screenshot for the output 
Note: in above screenshot VINET value is not displayed.   
Refer our API documentation for your reference 
Please get back to us if you have further queries.  
Vignesh Natarajan.  

Levi Leonards
Replied On April 19, 2019 11:17 AM UTC

Thanks, I was able to set my default filters using your example.

Vignesh Natarajan [Syncfusion]
Replied On April 19, 2019 11:25 AM UTC

Hi Levi,  

Thanks for the update. 

We are glad to hear that your query has been resolved by our solution. 

Please get back to us if you have further queries. 

Vignesh Natarajan.     


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

Live Chat Icon For mobile
Live Chat Icon