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

Use existing Excel-Filters f.e. "Last Week" in GGC

Thread ID:





143415 Mar 19,2019 05:56 PM UTC Mar 20,2019 10:45 AM UTC WinForms 1
Tags: GridGroupingControl
Asked On March 19, 2019 05:56 PM UTC


I use gridgroupingcontrol and I would like to use the existing Excel-Filter for example "Last week".
I have a date-column and I need all entries from last week.
But I would like to filter the data from my code not manually with the mouse.

Thank for your support

Arulraj A [Syncfusion]
Replied On March 20, 2019 10:45 AM UTC

Hi Thomas,  

Thanks for using Syncfusion product. 

You can filter the dates using the RecordFilters property programmatically as like in the following sample code but there is no option to select the option in the Date Filters UI programmatically. 

private void button1_Click(object sender, EventArgs e) 
    var today = DateTime.Now; 
    string expression = "[DOB] >= '" + today.GetPreviousWeeksDate(DayOfWeek.Sunday).Date + "' AND [DOB] <= '" + today.GetPreviousWeeksDate(DayOfWeek.Saturday).Date.DatesAbsoluteEnd() + "'"; 
public static class DateTimeExtension 
    public static DateTime GetPreviousWeeksDate(this DateTime givenDate, DayOfWeek dow) 
        int currentDay = (int)givenDate.DayOfWeek, endDay = (int)dow; 
        return givenDate.AddDays(-7).AddDays(endDay - currentDay); 
    public static DateTime DatesAbsoluteEnd(this DateTime dateTime) 
        return dateTime.Date.AddDays(1).AddTicks(-1); 


Please let us know if you need any further details on this. 
Arulraj A 


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