It's hard to say without seeing PropertyTimeSpan sorce code. Check that PropertyTimeSpan.PropertyValueType property is implemented and returns TimeSpan type.
Hi,
thanks for answering, but the PropertyTimeSpan code is from episerver.
Ah, yes. Did you try without BackingType attribute for TimeSpan properties? I think it should be assigned automatically.
[Display(Name = "Closes")]
public virtual TimeSpan Close { get; set; }
Hi Per!
Have you tried to register the EPiServer.SpecializedProperties.PropertyTimeSpan via the GUI in admin mode?
class name EPiServer.SpecializedProperties.PropertyTimeSpan, assembly name EPiServer, base type number.
--
Tarjei
@Dmytro yes I tried without backingtype.
@Tarjei, thanks. Registered it (don't know why it's not there already). I get a different edit mode dialog, a textbox and a dropdownlist with days, hours, minutes. Not quite what I expected and cannot save the value in edit mode even if I try different backing types (integer, floating point, string... )
Ok, maybe thats the reason why the TimeSpan property is gone from the list of registered property types …
Perhaps it is better to simply use a string property and a validator to get the input parseable as a TimeSpan. That would be easy for editors, a bit more hassle for you when you have to pase the string data, but you can use a UIHint and a display template to get it right every time when rendering. Or you can go all the way and make a block type (AvailableInEditMode=false) with several inputs, drop down lists and what not and force e timespan out of it.
How do you use the timespan as property on a block, for example showing a store openinghours?
E.g. this:
gives
he property 'Open' on content type 'OpeningHour' is of type 'System.TimeSpan' that cannot be backed by PropertyTimeSpan, it only only supports types Int32, Enum.
And removing the backing type prop gives :
The backing type 'EPiServer.SpecializedProperties.PropertyTimeSpan' is not a registered PropertyDefinitionType
What am i missing?