The Annoying DatePicker in DotNetNuke that still showing since version 6


The persistent issue remains that the DotNetNuke Team has yet to address a particular vexing problem. A few years ago, I was deeply engrossed in the development of custom modules utilizing DotNetNuke 5, which stood as the most recent iteration at that time. My client sought the Arabic localization of the backend UI, a seemingly straightforward request within an application platform like DotNetNuke, known for its utilization of .NET resource files on both global and local scales. However, a formidable challenge emerged involving the non-Gregorian (Hijri) date format, associated with specific Arabic locales such as (ar-sa, ar-ae, and others). By default, these locales invoked the .NET culture with the Hijri date format.

Complicating matters were the two default settings controls in DotNetNuke that employed Telerik Date pickers. These Telerik controls, regrettably, failed to discern the current UI culture and adapt the date format accordingly. Instead, they consistently assumed the date to be in Gregorian format, necessitating the explicit passing of other cultures to the Date pickers during the Page Init event. This deviation from DotNetNuke’s typical coding approach introduced a glaring error in date format when attempting to access either the Page Settings or any Module Settings. This discrepancy emerged due to the utilization of the aforementioned Date Picker in both ASCX files, which determined the start publishing and end publishing dates for the module or page.

The workaround involved inserting just two lines of code:

  1. For Page Settings, 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"); // ——————————————// // ... }
  1. For Module Settings, located at /admin/modules/Modulesettings.ascx.cs:
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"); // ——————————————// // ... }

Unfortunately, since that initial encounter, with every subsequent release of DotNetNuke, I’ve found myself perpetually copying and pasting these same two lines of code. The fervent hope remains that the DotNetNuke Team will rectify this issue in an upcoming release, ideally with DNN 8.0. I eagerly await such developments.