More in this section

Forums / Bugs & Issues / DateFieldElement in Custom Module, Default Value

DateFieldElement in Custom Module, Default Value

2 posts, 0 answered
  1. William
    William avatar
    108 posts
    15 Feb 2011
    04 May 2011
    Link to this post
    Hey all,

    I'm using a DateFieldElement in my custom module:

    var meetingDateTimeField = new DateFieldElement(mainSection.Fields)
        ID = "meetingDateTimeFieldControl",
        DataFieldName = "MeetingDateTime",
        DisplayMode = displayMode,
        Title = "MeetingDateTime",
        CssClass = "sfFormSeparator",
        ResourceClassId = typeof(MeetingsResources).Name,
        WrapperTag = HtmlTextWriterTag.Li,
        Value = DateTime.Parse("5/1/2011 12:15:12 PM"),

    My question is... how do you set a default value in for this field?  As you can see, I've tried doing this with a .Parse function.  I've also tried with DateTime.UtcNow.  I've tried going into the settings and manually setting the value as well.  No matter what, my control always defaults to 1/1/1901, which as you can imagine, is extremely hard to work with when you are wanting to tab through calendar months to now.

    Any tips?


    - William
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    04 May 2011
    Link to this post
    Hello William,

    We sent a reply to you in this thread. Lets keep the discussion on one place, so more users can find answers to the same questions.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered