change raddatetimepicker calender

2 posts, 1 answers
  1. jonathan
    jonathan avatar
    1 posts
    Member since:
    Feb 2011

    Posted 18 Feb 2011 Link to this post

    Hi everyone, i'm having a trouble to change the raddatetimepicker calender to display month and year only. my trying progress is shown as below. I will be using the telerik.web.ui.dll only. will i able to acheive what i want. any information is given would be grateful.

     

     

     

     

            <script type="text/javascript" >

     

                //override the onload event handler to change the picker after the page is loaded

     

                window.onload = function ()

     

                {

     

                    window.setTimeout(function() {SetCalendarTable();},200)

     

                }

     

               

     

                function SetCalendarTable() 

     

                {

     

                    var picker = $find("<%= RadDatePicker1.ClientID %>");

     

                    var calendar = picker.GetCalendar();

     

                    var fastNavigation = calendar.GetFastNavigation(); 

     

                                   

     

                    picker.PopupButton.onclick =

     

                        function()

     

                        {      

     

                            var textbox = picker.GetTextBox();

     

                              //adjust where to show the popup table

     

                               var x, y;

     

                            var adjustElement = textbox;

     

                            if (textbox.style.display == "none")

     

                                adjustElement = picker.popupImage();

     

                      

     

                               var pos = picker.GetElementPosition(adjustElement);

     

                               x = pos.x;

     

                               y = pos.y + adjustElement.offsetHeight;

     

                           

     

                            var e = {

     

                                          clientX : x,

     

                                          clientY : y

     

                                      };

     

                            //synchronize the input date if set with the picker one

     

                            var date = picker.GetDate();

     

                            if(date)

     

                            {

     

                                calendar.FocusedDate[0] = date.getFullYear();

     

                                calendar.FocusedDate[1] = date.getMonth() + 1;

     

                            }                       

     

                     

     

                            document.getElementById(calendar.TitleID).onclick(e);                   

     

                        }

     

                        

     

                    fastNavigation.OnOK =

     

                        function()

     

                        {                       

     

                            var date = new Date(fastNavigation.Year, fastNavigation.Month, 1);

     

                            picker.DateInput.SetDate(date);

     

                            fastNavigation.Popup.Hide();

     

                        }

     

                   

     

                   

     

                    fastNavigation.OnToday =

     

                        function()

     

                        {

     

                            var date = new Date();

     

                            picker.DateInput.SetDate(date);

     

                            fastNavigation.Popup.Hide();

     

                        }

     

     

     

     

     

                    }  

     

     

     

            </script>

     

     

  2. Answer
    Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 18 Feb 2011 Link to this post

    Hello jonathan,

    I suggest you use the implementation available in this code library entry to attain the functionality you are searching for. Furthermore, you may be happy to know that with the Q1 2011 release of the AJAX suite (ETA is mid March) we will introduce a separate month/year picker control. The Q1 2011 Beta version is expected at the end of the next week, you might give it a spin.

    Best regards,
    Sebastian
    the Telerik team
Back to Top