Strange rad date picker issue

0 Answers 47 Views
DatePicker UI for ASP.NET AJAX in ASP.NET MVC
Andrew
Top achievements
Rank 1
Andrew asked on 18 Jul 2023, 05:48 PM

Good day, I am using Teleik.Web.UI version 2023.1.323.40

I had to add this javascript to the date picker to get the current day to be focused in the calendar- when it is first opened.

I am not sure why this helped, is there a more suitable fix?

                                    datePickerDynCtrl.ClientEvents.OnPopupOpening =
                                        @"function(sender,eventArgs){ " +
                                        "var popup = eventArgs.get_popupControl(); " +
                                        "var todaysDate = new Date(); " +
                                        "popup.selectDate([todaysDate.getFullYear(),'',''], true); }"; 
Andrew
Top achievements
Rank 1
commented on 18 Jul 2023, 06:00 PM

Also I am aware there is a  datePicker.Calendar.FocusedDate property - it did not seem to focus the current day
Neha
Top achievements
Rank 2
Iron
Iron
commented on 21 Jul 2023, 11:58 AM

The Code sets the selectDate function of the RadDatePicker's popup control to select the current date by creating a new Date object representing today's date. The get_popupControl() function retrieves the popup control of the RadDatePicker, and selectDate is used to set the selected date in the calendar.

This approach is a suitable fix if you want the current date to be automatically focused when the date picker is opened.

No answers yet. Maybe you can help?

Tags
DatePicker UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Andrew
Top achievements
Rank 1
Share this question
or