Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
javascript Error onSelectedDayChanged
posted

Hey Guys!

Ive created a UserControl with your Calendar.

Worked fine .. but since this morning .. (i dont know why) i'll get always an error, if ill change my selected day .. same if i'll change the month..

Error: "old is undefined"
in: _setBackState: function (key, val)
Row: 353

Cant figure out, why ill get this error ..

I've tried, if it is something with the ViewState .. but I've not set any in this UserControl!
So if i click on one day, it doesnt jump in the DayChanged function.

My Code for the DayChanged function:

protected void DateChanged(object sender, CalendarSelectedDateChangedEventArgs e)
{
this.selectedDates = ((WebMonthCalendar)sender).SelectedDates.IndividualDates;
if (this.SelectedDayChanged != null)
{
this.SelectedDayChanged(sender, e);
}
((WebMonthCalendar)sender).SelectedDate = DateTime.Today;
}

Thanks for any solutions !



  • 155
    posted

    Okay .. now ive found out the line of code:

        function beforeSelectionChange(calendar, args) {
            var dates = args.get_dates();
            var range = args.get_range();
            if ((!range || range.length < 2) && dates && dates.length == 1)
                return;

            var evt = args.get_browserEvent();
            if (!evt || evt.ctrlKey || evt.shiftKey || evt.type != 'mousedown') {
                args.set_cancel(true);
                return;
            }
            var target = evt.target;
            if (!target)
                target = evt.srcElement;
            var css = target ? target.className : null;
            if (!css || css.indexOf('_WeekNumber') < 0) {
                args.set_cancel(true);
                return;
            }
        }

    there it goes in this _setBackState function and throw me this javascript error ...
    hope it helps!