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

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


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

1 Reply

AA Arulraj A Syncfusion Team 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 

Live Chat Icon For mobile
Up arrow icon