The Annoying DatePicker in DotNetNuke that still showing since version 6


It is really annoying that DotNetNuke Team didn’t yet put this annoying issue away,

Few years ago I was developing some custom modules using DotNetNuke 5, as it was the latest release that time. and client requested to have the backend UI localized to Arabic, that’s an easy request with an application platform environment like DotNetNuke, since it use the .NET resources files globally and locally, but the issue that I had to beat that time is the non-Gregorian (Hijri) date format which associated with the some Arabic locales like (ar-sa, ar-ae, and others) that by default load the .NET culture with Hijri date format. and the problem is:  there is two settings controls in DotNetNuke comes by default with Telerik Date picker. this Telerik control doesn’t read the current UI culture and adapt the date format accordingly, it always assume that the date is Gregorian formatted and other cultures should be explicitly passed to the Date picker at Page init event, which is not considered DotNetNuke code.

the error of invalid date format shows right away when you try to access the Page Settings or any Module Settings since both ASCX files that requested to load are using the Date Picker mentioned above in order to define start publishing and end publishing date of the module or the page. and my two lines of code that i had to place as a work around are:

1 – for Page Settings , file located at /DesktopModules/Admin/Tabs/ManageTabs.ascx.cs

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// THE DATEPICKER EXPLICIT CULTURE//
datepickerStartDate.Culture = new System.Globalization.CultureInfo(“en-US”);
datepickerEndDate.Culture = new System.Globalization.CultureInfo(“en-US”);
// ——————————————//

….

2 – for Module Settings, file located at /admin/modules/Modulesettings.ascx.cs

same event and same code as above, but here the two DatePickers controls named with defferent name

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// THE DATEPICKER EXPLICIT CULTURE//
endDatePicker.Culture = new System.Globalization.CultureInfo(“en-US”);
startDatePicker.Culture = new System.Globalization.CultureInfo(“en-US”);
// ——————————————//

 

and unfortunately since that year and with every new release of DotNetNuke I found my self copying the same two lines of code and placing them again and again.

hope that the Team in DNN release this fix with any of the coming release (hopefully with DNN 8.0). will wait and see.

Leave a Reply

Your email address will not be published. Required fields are marked *