Radscheduler shows nextday in timetime view at 11PM

2 posts, 0 answers
  1. Prava kafle
    Prava kafle avatar
    217 posts
    Member since:
    Apr 2010

    Posted 21 Feb 2013 Link to this post

    Hi,
     I have Radscheduler which displays next day's calendar after 11 PM.  I fixed the time range displayed in  timeline view of calendar  by setting start date  on initial page load. However when I click "Today" , it again shows next day in timeline view. 
    Is there any event fired on clicking"Today" so that I can set scheduler's selected date,  or  am I missing a setting?

    c# Code
      //PK 02/18/2013  Set selected date of scheduler, so it does not show next day's timelineview  at 11:00 PM
                   if (!IsPostBack)    
                       rsTicketsSchedule.SelectedDate = DateTime.Now.Date;

    ASPX:
      <telerik:RadScheduler ID="RadScheduler1" runat="server" Skin="Office2007"
                            Width="100%" RowHeaderWidth="52" OverflowBehavior="Auto" ShowFooter="false" DataSourceID="SchedulerDataSource"
                            DataKeyField="AppointmentID" DataStartField="Start" DataEndField="End" DataSubjectField="Subject"
                            CustomAttributeNames="Due, Priority" RowHeight="37px" OnAppointmentCommand="RadScheduler1_AppointmentCommand"
                            OnAppointmentInsert="RadScheduler1_AppointmentInsert" SelectedView="TimelineView" 

                           
                         >
                          <TimelineView GroupBy="Calendar" GroupingDirection="Vertical"  SlotDuration="00:30:00"
                               ColumnHeaderDateFormat="hh:mm"></TimelineView>
                            <AdvancedForm Modal="true"></AdvancedForm>
                            <AppointmentTemplate>
                                <%# Eval("Subject") %>
                                    <asp:Button runat="server" ID="UnscheduleAppointment" CssClass="simpleButton" CommandName="Unschedule"
                                    Text="&nbsp;" ToolTip="Unschedule this appointment"></asp:Button>
                            </AppointmentTemplate>
                            <TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
                            <AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings>
                       
                        </telerik:RadScheduler>

    http://demos.telerik.com/aspnet-ajax/scheduler/examples/timelineview/defaultcs.aspx

    Thanks,
    Prava
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 26 Feb 2013 Link to this post

    Hello,

    I would suggest using the OnNavigationCommand server-side event handler to cancel the default behavior when user clicks on Today's button and implement your custom logic as shown in code snippet:
    //markup code
    <telerik:RadScheduler runat="server" ID="RadScheduler1" OnNavigationCommand="RadScheduler1_NavigationCommand">         
        </telerik:RadScheduler>
    //code behind
    protected void RadScheduler1_NavigationCommand(object sender, SchedulerNavigationCommandEventArgs e)
    {
        if (e.Command == SchedulerNavigationCommand.NavigateToNextPeriod && RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
        {
            e.Cancel = true;
            RadScheduler1.SelectedDate = here goes the desired date
        }
    }

    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top