UPDATED:
Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the GridViewDataColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.
For Older Versions:
This example illustrates how to specify a column's FilterTemplate by using two ASPxDateEdit controls and use them for date range filtering:
- Enter the start and end date values;
- Call the client-side ASPxClientGridView.AutoFilterByColumn method and pass the target column's FieldName and entered values as parameters;
- Handle the server-side ASPxGridView.ProcessColumnAutoFilter event;
- Check if the currently processed column (e.Column.FieldName) is the target one. If so, retrieve the passed value (e.Value) and create data range filter criteria (e.Criteria) using the approach illustrated in the Create the Custom Filter Criteria example.
See Also:
E2203: CheckComboBox filtering in the Auto Filter Row
E1950: OBSOLETE - ASPxGridView - Date Auto Filter
E5038: GridView - How to implement date range filtering using a custom editor in the AutoFilterRow
Question Comments
Added By: Gunnar Steinn Magnússon at: 8/24/2012 9:03:41 AM
Could you please post a suggested way to do implement this with MVCxGridView?
Added By: esa s at: 7/29/2013 6:46:41 AMhi, in this sample by clicking twice on the Apply button (without changing dates), the dateSelector control would not be loaded and it will cause an exception in your gridview, would you please check this ? thanks
Added By: KenK at: 3/23/2016 3:22:31 PM The topic show OBSOLETE, but the new 15.2 option does NOT resolve this topic!The topic is "Date Range Filtering in the Filter Row", not the HeaderFilter!
Why can't the Date range filter be applied for the Filter row as well? Seems half-hearted to accommodate one without the other?