This is a migrated thread and some comments may be shown as answers.

XmlDataProvider and DateTime column

2 Answers 61 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yury
Top achievements
Rank 1
Yury asked on 01 Nov 2010, 10:51 AM
I'm trialing the latest version of Telerik 2010.2 WPF. So my experience with the toolkit is limited. I'm having the following problem:

I'm using XmlDataProvider as the data source. One of the elements of the XML file contains dates
    <Date>2010-10-30T01:01:01.0000000+08:00</Date>
I got around of the problem displaying those dates in a user friendly manner by handling AutoGeneratingColumn event and assigning a value converter to the Date column.

But what about filtering? I need to be able to filter the dates. I've tried to create a filter and specify member type as DateTime by for obvious reason the grid fails with invalid object type exception

var dtFilter = new FilterDescriptor("Date", FilterOperator.IsGreaterThanOrEqualTo, DateFrom);
dtFilter.MemberType = typeof(DateTime);
_filterDescriptior.FilterDescriptors.Add(dtFilter);


So my question is, when using XmlDataProvider, is there anyway to convert data to a native time (DateTime in my case).

Thanks,
Yury

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Nov 2010, 02:41 PM
Hello Yury,

 Why not convert this XML to a strongly typed class? It will be better if you work with DateTime directly instead dates as string. 

Regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Yury
Top achievements
Rank 1
answered on 05 Nov 2010, 03:42 AM
That’s what I eventually ended-up doing. Worked like a charm.
Thanks!


Regards,
Yury
Tags
GridView
Asked by
Yury
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Yury
Top achievements
Rank 1
Share this question
or