DateFieldElement in Custom Module, Default Value

Posted by Community Admin on 04-Aug-2018 01:16

DateFieldElement in Custom Module, Default Value

All Replies

Posted by Community Admin on 04-May-2011 00:00

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?

Thanks

- William

Posted by Community Admin on 04-May-2011 00:00

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

This thread is closed