Custom module DateFielElement issues

Posted by Community Admin on 05-Aug-2018 19:13

Custom module DateFielElement issues

All Replies

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

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,

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

Hello Duneel,
We have changed the data picker control to use jquery UI date picker  (jqueryui.com/.../) - 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 >>

This thread is closed