This question is locked. New answers and comments are not allowed.
Hi,
I have a GridView that displays DateTime values in the following datetime format "DD/MM/YYYY" and the cuture is set to "nl-NL".
But when I use filtering and I fill in a filter value for this column in the filter I have to use the MM/DD/YYYY format.
Is there a way that the filter can accept dates in the DD/MM/YYYY format?
Thanks,
Marcel
I have a GridView that displays DateTime values in the following datetime format "DD/MM/YYYY" and the cuture is set to "nl-NL".
But when I use filtering and I fill in a filter value for this column in the filter I have to use the MM/DD/YYYY format.
Is there a way that the filter can accept dates in the DD/MM/YYYY format?
Thanks,
Marcel
3 Answers, 1 is accepted
0
Hello Marcel,
Currently the filter does not respect the string format of the respective column. The only way to make both appear the same way is to use an IValueConverter:
I have attached the sample project that the above code snippets are from. I hope this helps.
All the best,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Currently the filter does not respect the string format of the respective column. The only way to make both appear the same way is to use an IValueConverter:
| public class DateToLongDateStringConverter : IValueConverter |
| { |
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| { |
| DateTime dateTime = (DateTime)value; |
| return dateTime.ToString("dd/MM/yyyy"); |
| } |
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
| { |
| throw new NotImplementedException(); |
| } |
| } |
| <UserControl x:Class="Ticket222538_DateTimeFilteringFormat.Page" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
| xmlns:local="clr-namespace:Ticket222538_DateTimeFilteringFormat;assembly=Ticket222538_DateTimeFilteringFormat" |
| > |
| <Grid x:Name="LayoutRoot" Background="White"> |
| <Grid.Resources> |
| <local:DateToLongDateStringConverter x:Key="myConverter" /> |
| </Grid.Resources> |
| <telerikGrid:RadGridView Name="RadGridView1" AutoGenerateColumns="False"> |
| <telerikGrid:RadGridView.Columns> |
| <telerikGrid:GridViewDataColumn |
| HeaderText="Date Received" |
| DataMemberBinding="{Binding Path=Received, Converter={StaticResource myConverter}}"/> |
| </telerikGrid:RadGridView.Columns> |
| </telerikGrid:RadGridView> |
| </Grid> |
| </UserControl> |
I have attached the sample project that the above code snippets are from. I hope this helps.
All the best,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Justin Brown
Top achievements
Rank 1
answered on 16 Dec 2009, 05:56 AM
This doesn't seem to address the issue.
For example, if I enter a 'dd/mm/yyyy' formatted date such as "30/6/1990", and specify "Is greater than or equal to", the filter still breaks (the grid appears empty - however it works fine if I enter "6/30/1990"). Could you please send me a solution to this problem. What would be really nice is a customised filter dialog using the date selection control for entering the dates... Just while you're at it like.... ;-)
Thanks
Justin
For example, if I enter a 'dd/mm/yyyy' formatted date such as "30/6/1990", and specify "Is greater than or equal to", the filter still breaks (the grid appears empty - however it works fine if I enter "6/30/1990"). Could you please send me a solution to this problem. What would be really nice is a customised filter dialog using the date selection control for entering the dates... Just while you're at it like.... ;-)
Thanks
Justin
0
Hello Justin,
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can check this demo for more info on how to create your own filter controls: http://demos.telerik.com/silverlight/#GridView/CustomFilterControls
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
