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

change raddatetimepicker calender

1 Answer 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
jonathan
Top achievements
Rank 1
jonathan asked on 18 Feb 2011, 12:15 PM
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>

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Sebastian
Telerik team
answered on 18 Feb 2011, 02:10 PM
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
Tags
General Discussions
Asked by
jonathan
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or