Modify DateField Format Settings within Sitefinity 4 Widget Templates

Sitefinity 4 enables users to modify the templates for many of the widgets that they supply within the default ToolBoxControls, much like the way that Sitefinity 3.7 allowed users to extend the templates by mapping ExternalTemplatePath’s. One of the many used fields in these new widgets is the EventStart/EventEnd/etc. fields. To modify the way they are output using C#, you just need to modify the way that the value attribute is rendered.

By default, the standard output looks something like

<sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("EventStart")%>' />

Changing the TextField itself to the below will output the EventStart data to display such as “Jun 10”

<sitefinity:TextField runat="server" DisplayMode="Read" Value='<%# Eval("EventStart", "{0:MMM dd}")%>' />
Posted in, C-Sharp, C#, HTML, Sitefinity 4