IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
DateField is used to display and edit fields of type DateTime. While displaying a date, you can control the format in which it is displayed. While editing, you can use a date picker:
When you are using static modules with normal C# or VB classes as your data model, you can include a definition for DateField for a property in your class of type DateTime. For more information on how to use definitions, you can read Custom Products module: Create the backend definitions.
To include a DateField, use the following code:
var eventStart =
new
DateFieldElement(mainSection.Fields)
{
ID =
"EventStartDate"
,
DataFieldName =
"EventStart"
Title =
DisplayMode = displayMode,
ResourceClassId =
typeof
(EventsResources).Name,
WrapperTag = HtmlTextWriterTag.Li,
CssClass =
"sfFormSeparator"
};
mainSection.Fields.Add(eventStart);
You can also use DateField in a custom field that you create through the user interface. You can do that in the built-in Sitefinity CMS modules (static and dynamic), as well as in your custom modules. When you are creating the custom field through the UI, you should select type Date and Time, as well as specify a custom widget for entering data. The type that you need to use is Telerik.Sitefinity.Web.UI.Fields.DateField.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important