Hello
I have a grid bound to a dataset, and one of the columns is of type TimeSpan. When editing a cell's value to this column, I type for example "10:30" and the value is rejected -calified as not valid. The MaskInput property is empty, by the way. What could be wrong?
Thanks a lot.
I'm not sure the grid can deal with a TimeSpan object. I'm surprised it lets you edit at all. Maybe you need to set the Style property on the column? Or perhaps you need to enter more digits. The default output of the ToString method of a TimeSpan inclues 6 digits if I am not mistaken, so you would need to enter "10:30:00".
I already tried with 6 digits and the same error happened.
The database column is of datatype Time (SQL Server 2008), therefore the DataColumn is of System.Timespan datatype.
What can I do?
Okay, I just took a look. The grid has no knowledge of what to do with a TimeSpan object, it just defaults to using a text editor. So if you type a string into the column, the grid will try to convert that string into a TimeSpan using the type converter. Apparently, the type converter for TimeSpan does not handle strings. When I try this, I get an exception:
Convert.ChangeType("10:10:10", typeof(TimeSpan));
So there's no way the grid can handle this.
What you would have to do is use a DataFilter and convert the string to a TimeSpan yourself using TimeSpan.Parse.
Is there samples where I can I see the DataFilter object in action?
I hope that in future versions this would not be necessary.
Hi David,
The feature request is probably already on the list. But by submitting it through the web site, we can keep track of how many customers are asking for it, and also who they are - in case we need customer input later from you about exactly what you need from the feature. :)
I will make this request now, but I *do* wish you would do this simple act yourselves instead of throwing it back at your customer (I see it throughout the forum). The fact that the issue has been reported, and the feature requested in the forum (several times), is enough for Infragistics to add this to their own requested features list.
No, there is still no TimeZone TimeSpan editor. If you have not already done so, you should Submit a feature request to Infragistics
Is support for TimeSpan been included yet in 9.1? I am having the same issue when trying to use the Time datatype with using SQL Server 2008.
No, no such support has been added in v.8.3.