This is a migrated thread and some comments may be shown as answers.

RadDateTimePicker: Microsoft JScript runtime error: 'this.Slots.Month' is null or not an object

1 Answer 54 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Edwin
Top achievements
Rank 1
Edwin asked on 14 Jan 2009, 02:14 AM
The problem can be reproduced in this page.

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml">

 

<

 

head runat="server">

 

 

<title></title>

 

 

<script runat="server">

 

 

protected override void InitializeCulture()

 

{

System.Globalization.

CultureInfo cultureInfo =

 

(System.Globalization.

CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();

 

cultureInfo.DateTimeFormat.ShortDatePattern =

"d MMM yy";

 

 

try

 

{

System.Threading.

Thread.CurrentThread.CurrentCulture = cultureInfo;

 

}

 

catch

 

{

}

 

base.InitializeCulture();

 

}

 

</script>

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

<telerik:RadScriptManager ID="sscriptmgr" runat="server">

 

 

</telerik:RadScriptManager>

 

 

<div>

 

 

<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server">

 

 

</telerik:RadDateTimePicker>

 

 

</div>

 

 

</form>

 

</

 

body>

 

</

 

html>

Error happened when a date or time is selected from the calendar.
I need to initialize the CultureInfo because I need to control the displayed DateTime format.

Your help is much apprepciated.

Edwin

 

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Jan 2009, 09:30 AM
Hi Edwin,

In your custom DateTimeFormat you are using a DateSeparator (space), which is different from the default one for the current culture (slash). You should set the DateSeparator explicitly:

cultureInfo.DateTimeFormat.ShortDatePattern = "dd MMM yy";
cultureInfo.DateTimeFormat.DateSeparator = " ";


Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar
Asked by
Edwin
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or