When I add a Grid View, the text filtering works OK. However, it appears that there is still no way to select a date range, the ShowHeaderFilterButton option drops down a list of distinct values (not a calendar as expected), and the filtering insists on using mm/dd/yyyy date formats, which is completely inappropriate for a British application.
Can you please let me know how to get the filtering to work with a dd/MM/yyyy date format (I have the globalisation set to en-GB in the web.config, and the system is configured as British English and is using dd/MM/yyyy date formats for non-DevExpress date parsing)?
Can you please also let me know how to prompt the headerfilterbutton dropdown to show a calendar selection?
Finally, is it possible yet to do a date range? The last response I found on this was in 2008 suggesting it wasn't yet possible in the ASPxGrid controls without doing custom filtering?
Thank you for the detailed description of the issue. Here are answers to your questions:
>> Can you please let me know how to get the filtering to work with a dd/MM/yyyy date format
To set the required format of the displayed data, specify the DateEditProperties.DisplayFormatString property of a required Date DataColumn via the column's editor properties. The same format will be applied to items displayed within a Filter DropDown:
var column = new MVCxGridViewColumn("HireDate", MVCxGridViewColumnType.DateEdit); ((DevExpress.Web.ASPxGridView.GridViewEditDataColumn)(column)).PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; settings.Columns.Add(column);
>> Can you please also let me know how to prompt the headerfilterbutton dropdown to show a calendar selection?
The ASPxGridView control, whose functionality is used by the MVC GridView extension, does not support the built-in Data-Range filtering functionality for the following reason:
The type of the editor that is rendered within the EditForm and AutoFilterRow is determined by the type of the column:
- the GridViewDataTextColumn renders the ASPxTextBox editor;
- the GridViewDataDateColumn renders the ASPxDateEdit editor;
Since there is no specially designed editor for the Date-Range operations in the ASPxEditors Suite, the ASPxGridView does not allow creating the corresponding DataColumn.
It is possible to accomplish this task by using the ASPxDropDownEdit editor, which allows customizing its DropDownWindowTemplate with two ASPxDateEdit editors for selecting Date-Range. However, this approach requires the use of the ASPxGridView.ProcessColumnAutoFilter event (see the Date range filtering in the Filter Row Code Central example for more information), whose analog does not exist in the MVC GridView extension. If you wish, you can create a corresponding request to support the required event's analog for the MVC GridView extension.