Get selected view in JS

3 posts, 1 answers
  1. Esben
    Esben avatar
    11 posts
    Member since:
    Dec 2012

    Posted 14 Dec 2012 Link to this post

    Hi

    Is it possible to get information on which view (Month, Day, Timeline) is selected in JS on page load? I am aware of the OnClientNavigationCommand property, but I need the selected view on load - not only when it changes.

    Thanks!
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Dec 2012 Link to this post

    Hi Esben,

    Try the following code snippet to achieve your scenario.

    JS:
    <script type="text/javascript">
        function pageLoad() {
            var scheduler = $find("<%= RadScheduler1.ClientID %>");
            if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.DayView) {
                alert("The selected view is DayView");
            }
           else if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.WeekView) {
                alert("The selected view is WeekView");
            }
            else if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.MonthView) {
                alert("The selected view is MonthView");
            }
           else if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.TimelineView) {
               alert("The selected view is TimelineView");
            }
          else  if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.MultiDayView) {
                alert("The selected view is MultiDayView");
            }
        }
    </script>

    Please take a look into this documentation for more information.

    Regards,
    Princy.
  3. Esben
    Esben avatar
    11 posts
    Member since:
    Dec 2012

    Posted 19 Dec 2012 Link to this post

    Thank you, I'll have a look at it.
Back to Top