Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
It sounds like there could be something wrong with your Property. Can you explain how your Property is created? Also have a look in Admin mode to check whether your Property accually is stored as a DateTime.
Also, personally I would prefer to use PropertyControlBase if you only want to render for visitor and not change the behaviour for editors.
See http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/10/Custom-renderers-for-properties/
It's not a custom property, It's EPiServers default Date property.
I can agree with you but in this case, the date is to be formatted when the editor is editing too.
I took that exact code and it works for string properties but not for the date property. Hmm. Any more ideas?
Hi, I meant how you add the Property to your Page Type? Manually or by code?
By code ofc. :)
[Searchable(false)]
[Display(
Name = "Datum",
Order = 10
)]
public virtual DateTime Date { get; set; }
Could you give what the code looks like?
Also, have a look in Admin mode at the Property to tell whether EPiServer have interpreted your code and updated the database correctly. When the behaviour on Properties isn't what I expect, I usually find some clues here.
Ah replied before I saw your code.
This seems to look correct. Now is the questions if EPiServer has the correct values in the database?
Yes, I checked that too and the property definition type is 5, which is Date.
This must be a bug?
Where are you telling the property to use the renderer tagged "FormatDate"? Are you adding a tag to the property webcontrol or propertyFor call?
<episerver:property propertyName="Date" customTagName="span" cssClass="date" runat="server">
<renderSettings tag="FormatDate" />
</episerver:property>
I can't replicate having an EditorDescriptor for a DateTime either.
I've tried creating classes inheriting PropertyDateControl and PropertyControlBase<DateTime>.
It seems like the TemplateResolver doesn't register these Templates correctly?
Should something more be specified on the TemplateDescriptor?
Hi!
I have reproduced the issue, created a bug and also made a fix since it was a quite small change. The bug for further tracking is:
Bug #101219: It's not possible to add custom renderers to some built in property types
I've tried to create a "DateFormat"-renderer where you can specify a format for a date property (duh :)).
Nothing strange at all really: