RadDatePicker/Calendar has is null or not an object jscript error

2 posts, 0 answers
  1. Nancy
    Nancy avatar
    1 posts
    Member since:
    Dec 2008

    Posted 17 Dec 2008 Link to this post

    When using RadDatePicker with a shared RadCalendar I cannot select a date,  then change my mind and select a different date.
    In recreating the error in a separate project, to send with this problem, I found that this works fine until I add the RadAjaxManager
    and cause the code to execute javascript code before saving the data to the screen.  Steps to recreate:
        Enter a date and confirm.
        Then click on the calendar again to attempt to change the date.
        First message occurs:
    ----------
    Line: 2235   (line # differs depending on executing page - usually is 2221 - in sample it is 2235) *maybe in RadCalendar.js ??
    Char: 13
    Error: 'this.CurrentViews.length' is null or not an object
    Code: 0
    URL: ...TestRadDatePicker.aspx
    ----------
    If I continue to select a different year and month, nothing changes and the 2nd message also occurs.
    ----------
    Line: 2415  (line # differs depending on executing page - usually is 2443) - in sample it is 2415)
    Char: 1
    Error: 'this.CurrentViews.0' is null or not an object
    Code: 0
    URL: http://localhost:1033/TestRadDatePicker.aspx
    --------------
    The char position and messages are always the same.  I am hoping you can provide me with some assistance in this matter.
    Here is the .aspx code:
    -----

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestRadDatePicker.aspx.vb" Inherits="RadControlsTest._RadDatePickerTest" %>

    <%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %>

    <%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %>

    <!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>TestRadDatePicker</title>
        <SCRIPT language="javascript" type="text/javascript" src="TestRadDatePicker.js"></SCRIPT>
    </head>
    <body onload="RunOnLoad();">
        <form id="form1" runat="server">
        <div>
            <tr><td>
            <table id="tblGetDate" runat="server" width="100%" border="0" align="left">
                <tr width="100%" align="left">
                    <td width="10%">&nbsp;</td>
                    <td height="10px" valign="middle" align="left" width="21%">
                        <asp:Label ID="lblDOB" runat="server" width="100%" style="Text-align: left; font-size: 9pt;" Text="Date Of Birth:" Font-Bold="True"></asp:Label>
                    </td>
                   <td height="10px" align="left" valign="top" style="width: 15%">
                        <radCln:RadDatePicker ID="RadDatePicker1" runat="server"
                                SharedCalendarID="RadCalendar1"
                             Width="90%"
                             ToolTip="If typing a date, use mmddyy or M/d/yy format ... or select a date from calendar. Date of birth must be less than today."
                                MinDate=""
                                FocusedDate="">
                              <DateInput
                                    Skin=""
                                    Font-Size="8pt"
                                    AutoPostBack="True"
                                    CausesValidation="True"
                                    DateFormat="MM/dd/yyyy">    
                                 <EmptyMessageStyle
                                        BackColor="#E0E0E0"  
                                        Font-Italic="True" />
                               <InvalidStyle
                                        BorderColor="#E0E0E0"
                                        ForeColor="Red"
                                        Font-Bold="True" />
                              </DateInput>
                        </radCln:RadDatePicker>
                    </td>
                    <td width="63%" valign="middle" style="line-height: 10px;">
                        <asp:Label ID="valDOB" runat="server" style="line-height: 15px;" Font-Bold="True" Font-Size="8pt" ForeColor="Red" Width="90%"></asp:Label>
                    </td>
                </tr>
            </table>
            </td></tr>
            <tr height="3px">
            <td style="height: 3px; width: 802px;">
                <!-- Calendar goes here -->

                <radCln:RadCalendar ID="RadCalendar1" runat="server"
                        Font-Names="Arial, Verdana, Tahoma"
                        ForeColor="Black"
                        Style="border-left-color: #ececec; border-bottom-color: #ececec;
                               border-top-color: #ececec; border-right-color: #ececec"
                        EnableMultiSelect="False"
                        ShowRowHeaders="False"
                        UseColumnHeadersAsSelectors="False"
                        DayNameFormat="Shortest"
                        Width="159px"
                        RangeMaxDate="12/31/2099"
                        RangeMinDate="" >
                        <FastNavigationSettings EnableTodayButtonSelection="True" />
                        <SpecialDays>
                            <radCln:RadCalendarDay Repeatable="Today" Date="" >
                                <ItemStyle CssClass="radCalToday_Default" />
                            </radCln:RadCalendarDay>
                        </SpecialDays>
                        <DayOverStyle BackColor="InactiveCaptionText" />
                        <TitleStyle BackColor="InactiveCaptionText" />
                        <SelectedDayStyle Font-Bold="True"/>
                </radCln:RadCalendar>
            </td>
            </tr>
            <radA:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableOutsideScripts="True">
                <AjaxSettings> 
                    <radA:AjaxSetting AjaxControlID="RadDatePicker1">
                        <UpdatedControls>
                            <radA:AjaxUpdatedControl ControlID="RadDatePicker1" />
                        </UpdatedControls>
                    </radA:AjaxSetting>
                </AjaxSettings>
                <ClientEvents OnRequestStart="ProcessByEvent" />
            </radA:RadAjaxManager>
        </div>
        </form>
    </body>
    </html>


    Please let me know if you need to see more source (.aspx.vb and/or  .js )... or
    if you need the whole project/solution.  I can provide whatever is needed to figure this out.
    Thanks.  Nancy
  2. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 20 Dec 2008 Link to this post

    Hello Nancy,

    In order to make it work you need to add the Calendar to the updated controls of the RadAjaxManager similar to the following:
    <radA:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableOutsideScripts="True">  
        <AjaxSettings>    
            <radA:AjaxSetting AjaxControlID="RadDatePicker1">  
                <UpdatedControls>  
                    <radA:AjaxUpdatedControl ControlID="RadDatePicker1" />  
                    <radA:AjaxUpdatedControl ControlID="RadCalendar1" />  
                </UpdatedControls>  
            </radA:AjaxSetting>  
        </AjaxSettings>  
        <ClientEvents OnRequestStart="ProcessByEvent" />  
    </radA:RadAjaxManager>  

    I hope this helps.

    Regards,
    Pavel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top