+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / Custom module DateFielElement issues

Custom module DateFielElement issues

2 posts, 0 answered
  1. Duneel
    Duneel avatar
    166 posts
    Registered:
    08 Dec 2010
    02 May 2011
    Link to this post
    Hi Ivan,

    I've upgrated a custom module to 4.1 and now my date fields are appearining differenty on backend views. See the attached screenshot.

    It has some other problems too. Now by default it is set to 1901/1/1 where as in 4.0 it was defaulted to the current system date. Now there aren't buttons to open the callendar. It openes only when the textfield get focused, with this it's really difficult to manually enter/modify the date. Another issue is the calendar controls seems very complex now and it overlaps with other buttons on the page.

    Is it possible to have the carendar working as before with the same look and feel?

    this is how I'm defining the date field in my custom modules definitions class.

    var releasedateField = new DateFieldElement(mainSection.Fields)
            {
                ID = "releasedateFieldControl",
                DataFieldName = "ReleaseDate",
                DisplayMode = displayMode,
                Title = "ReleaseDate",
                //CssClass = "sfTxt",
                ResourceClassId = typeof(BrightcoveVideoResources).Name,
                WrapperTag = HtmlTextWriterTag.Li,
      
            };


    Thanks,
  2. Nikolay Datchev
    Nikolay Datchev avatar
    87 posts
    Registered:
    01 Nov 2016
    11 May 2011
    Link to this post
    Hello Duneel,
    We have changed the data picker control to use jquery UI date picker  (http://jqueryui.com/demos/datepicker/) - since this control allows more powerfull localization scenarios. If you really need to have the old look and behaviour i can send you the code of the previous control. I am not sure why it defaults to 1901 in your case, Is it possible that the date field that you bind the control to already has this date. You can override the default date in your field by simply overriding your DataProvider CreateItem  method to put the current date in the field. For example the OpenAccessNewsProvider has the following code:

    public override NewsItem CreateNewsItem(Guid id)
            {
                var newsItem = new NewsItem(this.ApplicationName, id);
                newsItem.Owner = SecurityManager.GetCurrentUserId();
                var dateValue = DateTime.UtcNow;
                newsItem.DateCreated = dateValue;
                newsItem.PublicationDate = dateValue;
                ......

    If you really need the original control please let me know. I can send the code and you can compile it in your custom module. Then when you use the DateField defintion you can override which control is used by explicitly settting the FieldType property.



    Greetings,
    Nikolay Datchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

2 posts, 0 answered