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

Move Calendar display to Todays Date.

1 Answer 21 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Merlin
Top achievements
Rank 1
Merlin asked on 26 Feb 2013, 02:18 AM
Hi,

I am using radcalendar for displaying the dates. I want to add a RadButton and On clicking the button, I want to navigate to today's date in the calendar. I want this to be done using client side code.

Please help,Thanks,
Merlin.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 26 Feb 2013, 04:32 AM
Hello Merlin,

Try the following JavaScript and attach it to the OnClientClicked event of the RadButton.

JavaScript:
<script type="text/javascript">
    function OnClientClicked(sender, args) {
        var today = new Date();
        var day = today.getDate();
        var month = today.getMonth() + 1;
        var year = today.getFullYear();
        var calendar = $find("<%=RadCalendar1.ClientID%>");
        var todaysdate = [year, month, day];
        calendar.navigateToDate(todaysdate);
    }
</script>

Thanks,
Princy.
Tags
Calendar
Asked by
Merlin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or