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

Show24hours toggle button in radScheduler doesnot toggle to show businesshours

5 Answers 15 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Prava kafle
Top achievements
Rank 1
Prava kafle asked on 08 Jul 2014, 07:50 PM
Hi,
DayView in my webservicebound scheduler does not  toggle between 24 hours and businesshours. I am sending ajaax request to server to handle  navigation command. It renders timeslots properly for 24 hours and business hours but doesnot toggle the buttons and always displays "show 24 hours" button.

Here is my server side code, can you tell me if I need any extra configuration?

 ////PK MWF-897  03/31/2014   configure to display 24 hour timeslot  in day and week view
                    if (calendarCommandArgs[2] == "9" && rsTicketsSchedule.DayView.DayStartTime != new TimeSpan(0, 0, 0)) //Show  scheduler for 24 hours 
                    {
                        rsTicketsSchedule.DayView.DayStartTime = new TimeSpan(0, 0, 0);
                        rsTicketsSchedule.DayView.DayEndTime = new TimeSpan(23, 60, 0);
                        
                        rsTicketsSchedule.WeekView.DayStartTime = new TimeSpan(0, 0, 0);
                        rsTicketsSchedule.WeekView.DayEndTime = new TimeSpan(23, 60, 0);
                        
                        rsTicketsSchedule.WorkDayStartTime = new TimeSpan(8, 00, 00);
                        rsTicketsSchedule.WorkDayEndTime = new TimeSpan(18, 30, 00);
                    }
                    else
                    {
                        rsTicketsSchedule.WeekView.DayStartTime = new TimeSpan(8, 0, 0);
                        rsTicketsSchedule.WeekView.DayEndTime = new TimeSpan(18, 30, 00);

                        rsTicketsSchedule.DayView.DayStartTime = new TimeSpan(8, 0, 0);
                        rsTicketsSchedule.DayView.DayEndTime = new TimeSpan(18, 30, 00);
                       

                        rsTicketsSchedule.WorkDayStartTime = new TimeSpan(8, 00, 00);
                        rsTicketsSchedule.WorkDayEndTime = new TimeSpan(18, 30, 00);
                    }


Thanks,
Prava

5 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 11 Jul 2014, 12:07 PM
Hello,

The scenario described is not quite clear. I have tested the toggle between 24 hours and business hours mode and it worked correctly both at my side and on our on-line demos.

Would you please elaborate the scenario a little bit so we could be more helpful?

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Prava kafle
Top achievements
Rank 1
answered on 11 Jul 2014, 01:54 PM
I have a webservice bound scheduler but I am handelling some of the
scheduler events (navigation control click) with serevrside code by
firing ajax request using dummy button.



Here is how my scheduler is defined in aspx page.  In DayView timeslots
are rendered properly on click of "show 24 hours"/"Show business hours"
but button doesnit chahe the text. It always displays "show 24 hour's"
event though it's already displaying 24 hours.



  <telerik:RadScheduler runat="server"  ID="rsTicketsSchedule"

                                    OnResourcesPopulating="rsTicketsSchedule_ResourcesPopulating"

                                    OnTimeSlotCreated="rsTicketsSchedule_TimeSlotCreated"

                                    OnClientAppointmentsPopulated="OnClientAppointmentsPopulated"

                                    OnClientAppointmentsPopulating="OnClientAppointmentsPopulating"

                                    OnClientResourcesPopulating="OnClientResourcesPopulating"

                                    OnClientAppointmentClick="rsClientAppointmentSingleClick"

                                    OnClientAppointmentCreated="OnAppointmentCreated"

                                    OnClientAppointmentDoubleClick="rsClientAppointmentDoubleClick"

                                    OnClientFormCreated="ClientFormCreated"

                                    OnClientAppointmentMoveEnd="AppointmentMoved"

                                    OnClientAppointmentResizeStart="OnAppointmentResizeStart"

                                    OnClientAppointmentResizeEnd="OnAppointmentResizeEnd"

                                    OnClientAppointmentWebServiceDeleting="OnAppointmentDeleting"

                                    OnClientAppointmentWebServiceUpdating="OnAppointmentUpdating"

                                    OnClientRequestSuccess="OnClientRequestSuccess"

                                    OnClientRequestFailed="OnClientRequestFailed"

                                    OnClientAppointmentMoveStart="StopTimer"

                                    OnClientAppointmentDataBound="OnClientAppointmentDataBound"

                                    OnClientDataBound="onSchedulerDataBound"

                                    AllowInsert ="False"

                                    DisplayDeleteConfirmation="True"

                                    Localization-HeaderToday="Today"

                                    EnableCustomAttributeEditing="True"

                                    EnableDescriptionField="True"

                                    Height="100%"

                                    EnableExactTimeRendering="true"

                                    EnableViewState="true"

                                    OverflowBehavior="Scroll"

                                    ShowAllDayRow ="false"   

                                    SelectedView="TimelineView"

                                    AppointmentStyleMode="Default"

                                    OnClientAppointmentContextMenu ="OnClientAppointmentContextMenu"

                                    OnClientAppointmentContextMenuItemClicked="handle_AppointmentContextMeniItemClick"

                                    OnClientNavigationComplete = "OnClientNavigationComplete"

                                    OnClientNavigationCommand="OnClientNavigationCommand"

                                    OnClientAppointmentEditing="OnClientAppointmentEditing"

                                    OnClientRecurrenceActionDialogShowing="OnClientRecurrenceActionDialogShowing"

                                    OnResourceHeaderCreated="rsTicketsSchedule_ResourceHeaderCreated"

                                >

                               <AdvancedForm  Modal="True"  />

                                <DayView UserSelectable="True" GroupBy="TechName" GroupingDirection="Horizontal"   />

                                <WeekView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical"  />

                                <MonthView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical"  />



                                <TimelineView  

                                    GroupBy="TechName"

                                    ColumnHeaderDateFormat="h:mm tt"

                                    GroupingDirection="Vertical"

                                    HeaderDateFormat="MM/dd/yyyy h:mm tt"

                                    NumberOfSlots ="21"  

                                    SlotDuration="00:30:00"

                                    StartTime="08:00:00"  />



                                      <WebServiceSettings  
Path="WorkforceServices/M4SchedulerWebService.asmx"
ResourcePopulationMode="ServerSide" />



                                <AppointmentContextMenus >

                                    <telerik:RadSchedulerContextMenu
ID="RsTicketsScheduleContextMenu" runat="server"   >
</telerik:RadSchedulerContextMenu>

                                </AppointmentContextMenus>



                                <ResourceTypes>

                                    <telerik:ResourceType Name="TechName" />

                                    <telerik:ResourceType Name="TicketState" />

                                </ResourceTypes>



                                <%-- MWF-752 EG 05/06/2014 --%>

                                <ResourceHeaderTemplate>

                                    <div>

                                       <asp:Label ID="ResourceLabel" runat="server" Text="Label"/>

                                    </div>

                                </ResourceHeaderTemplate>



                      </telerik:RadScheduler>





This is how I am setting timeslots for each view

   public class ScheduleViewModifier

    {

        public DayOfWeek GetSchedulerEndDate(int daysToAdd)

        {

            DayOfWeek schedulerEndDay = DateTime.Now.AddDays(daysToAdd).DayOfWeek;

            return schedulerEndDay;

        }



        public void SetSchedulerToDayView(RadScheduler rsTicketsSchedule)

        {

            rsTicketsSchedule.ShowAllDayRow = false;

            rsTicketsSchedule.EnableExactTimeRendering = true;

            //PK MWF-672 08/20/2013

            ////kk MWF-527  start

            //rsTicketsSchedule.ColumnWidth = 80;

            ////kk MWF-527  end

            rsTicketsSchedule.RowHeight = 30;

            rsTicketsSchedule.MinutesPerRow = 30;

            rsTicketsSchedule.TimeLabelRowSpan = 2;

            rsTicketsSchedule.TimelineView.TimeLabelSpan = 2;

            rsTicketsSchedule.ShowFooter = true;

            rsTicketsSchedule.WorkDayStartTime = new TimeSpan(9, 00, 00);

            rsTicketsSchedule.WorkDayEndTime = new TimeSpan(17, 30, 00);

           

            

        }



        public void SetSchedulerToTimeLineView(RadScheduler rsTicketSchedule)

        {

            rsTicketSchedule.RowHeight = 30;

            rsTicketSchedule.MinutesPerRow = 30;

            rsTicketSchedule.TimeLabelRowSpan = 1;

            rsTicketSchedule.NumberOfHoveredRows = 2;

            rsTicketSchedule.TimelineView.TimeLabelSpan = 1;

        }



        public void SetSchedulerToWeekView(RadScheduler rsTicketsSchedule)

        {

            if (HttpContext.Current.Request["TicketID"] != null)

            {

                //PK MWF-672 08/20/2013

                ////kk MWF-527  start

                //rsTicketsSchedule.ColumnWidth = 352;

                ////kk MWF-527  end

                rsTicketsSchedule.RowHeight = 40;

                rsTicketsSchedule.MinutesPerRow = 30;

                rsTicketsSchedule.TimeLabelRowSpan = 1;



                rsTicketsSchedule.EnableExactTimeRendering = false;



                rsTicketsSchedule.FirstDayOfWeek = DayOfWeek.Monday;

                rsTicketsSchedule.LastDayOfWeek = DayOfWeek.Friday;

                rsTicketsSchedule.NumberOfHoveredRows = 1;

                

            }

            else

            {

                //PK MWF-672 08/20/2013

                ////kk MWF-527  start

                //rsTicketsSchedule.ColumnWidth = 352;

                ////kk MWF-527  end

                rsTicketsSchedule.RowHeight = 40;

                rsTicketsSchedule.MinutesPerRow = 1440;

                rsTicketsSchedule.TimeLabelRowSpan = 1;

              //  rsTicketsSchedule.WorkDayStartTime = new TimeSpan(08, 00, 00);

              //  rsTicketsSchedule.WorkDayEndTime = new TimeSpan(17, 00, 00);

                rsTicketsSchedule.ShowFooter = false;

                rsTicketsSchedule.ShowAllDayRow = false;

                rsTicketsSchedule.EnableExactTimeRendering = false;

                rsTicketsSchedule.WeekView.ShowHoursColumn = false;



                rsTicketsSchedule.FirstDayOfWeek = DayOfWeek.Monday;

                rsTicketsSchedule.LastDayOfWeek = DayOfWeek.Friday;



                rsTicketsSchedule.NumberOfHoveredRows = 1;

                rsTicketsSchedule.ShowFullTime = false;

                

                

            }



        }



        public void SetSchedulerToMonthView(RadScheduler rsTicketSchedule)

        {

            rsTicketSchedule.ShowAllDayRow = false;

            rsTicketSchedule.EnableExactTimeRendering = false;

            //PK MWF-672 08/20/2013

                ////kk MWF-527  start

            //rsTicketSchedule.ColumnWidth = 251;

            ////kk MWF-527  end

            rsTicketSchedule.RowHeight = 25;

            rsTicketSchedule.MinutesPerRow = 1440;

            rsTicketSchedule.TimeLabelRowSpan = 1;

            rsTicketSchedule.NumberOfHoveredRows = 1;

            rsTicketSchedule.FirstDayOfWeek =  DayOfWeek.Sunday;   //DateTime.Now.DayOfWeek;

            rsTicketSchedule.LastDayOfWeek = DayOfWeek.Saturday;  //GetSchedulerEndDate(6);

            

        }





        public void ModifySchedulerView(SchedulerNavigationCommand schedulerNavigationCommand, RadScheduler rsTicketsSchedule)

        {

            switch (schedulerNavigationCommand)

            {

                case (SchedulerNavigationCommand.SwitchToTimelineView):

                    SetSchedulerToTimeLineView(rsTicketsSchedule);

                    break;

                case (SchedulerNavigationCommand.SwitchToDayView):

                    SetSchedulerToDayView(rsTicketsSchedule);

                    break;

                case (SchedulerNavigationCommand.SwitchToWeekView):

                   SetSchedulerToWeekView(rsTicketsSchedule);

                    break;

                case (SchedulerNavigationCommand.SwitchToMonthView):

                   SetSchedulerToMonthView(rsTicketsSchedule);

                    break;

                    //AS:7/10/2012 MWF 253

                case (SchedulerNavigationCommand.SwitchToSelectedDay):



                    switch (rsTicketsSchedule.SelectedView.ToString())

                    {

                        case "WeekView":

                            SetSchedulerToWeekView(rsTicketsSchedule);

                            break;

                        case "DayView":

                            SetSchedulerToDayView(rsTicketsSchedule);

                            break;

                        case "MonthView":

                            SetSchedulerToMonthView(rsTicketsSchedule);

                            break;

                        case "TimelineView":

                            SetSchedulerToTimeLineView(rsTicketsSchedule);

                            break;

                    }

                    break;

                // MN 3/28/12 DEV-3999 SwitchToSelectedDay is changed to
execute by default. No customized event handling is required

                // to switch the view to Today or to any day from Calendar



                //case(SchedulerNavigationCommand.SwitchToSelectedDay):

                //    SetSchedulerToDayView(rsTicketsSchedule);

                //    break;





            }



        }









    }



I hope this helps in understanding my issue.

Thanks,

Prava

0
Prava kafle
Top achievements
Rank 1
answered on 11 Jul 2014, 01:57 PM
In addition to above code, on click of  navigation controls especially "show24hour's/show business hours" I am executing following code by sending ajax request
 //Updates scheduler and popup calendar to display correct date
    protected void ScheduleUpdateNavigationBtn_click(object sender, EventArgs e)
    {
        try
        {
          
     ...........

                    ////PK MWF-897  03/31/2014   configure to display 24 hour timeslot  in day and week view
                    if (calendarCommandArgs[2] == "9" && rsTicketsSchedule.DayView.DayStartTime != new TimeSpan(0, 0, 0)) //Show  scheduler for 24 hours  // if (calendarCommandArgs[2] == "8"  &&  rsTicketsSchedule.WeekView.DayStartTime != new TimeSpan(0, 0, 0)) //Show  scheduler for 24 hours
                    {
                        rsTicketsSchedule.DayView.DayStartTime = new TimeSpan(0, 0, 0);
                        rsTicketsSchedule.DayView.DayEndTime = new TimeSpan(23, 60, 0);
                        
                        rsTicketsSchedule.WeekView.DayStartTime = new TimeSpan(0, 0, 0);
                        rsTicketsSchedule.WeekView.DayEndTime = new TimeSpan(23, 60, 0);
                        
                        rsTicketsSchedule.WorkDayStartTime = new TimeSpan(8, 00, 00);
                        rsTicketsSchedule.WorkDayEndTime = new TimeSpan(18, 30, 00);
                    }
                    else
                    {
                        rsTicketsSchedule.WeekView.DayStartTime = new TimeSpan(8, 0, 0);
                        rsTicketsSchedule.WeekView.DayEndTime = new TimeSpan(18, 30, 00);

                        rsTicketsSchedule.DayView.DayStartTime = new TimeSpan(8, 0, 0);
                        rsTicketsSchedule.DayView.DayEndTime = new TimeSpan(18, 30, 00);
                       

                        rsTicketsSchedule.WorkDayStartTime = new TimeSpan(8, 00, 00);
                        rsTicketsSchedule.WorkDayEndTime = new TimeSpan(18, 30, 00);
                    }

................................
......................................


Regards,
Prava
0
Accepted
Bozhidar
Telerik team
answered on 14 Jul 2014, 09:56 AM
Hi Prava,

Instead of setting DayStartTime to (0,0,0), please try using the rsTicketsSchedule.ShowFullTime property. Here's how the modified code should look like:
if (calendarCommandArgs[2] == "9" && rsTicketsSchedule.ShowFullTime == false)
{
    rsTicketsSchedule.ShowFullTime = true;
}
else
{
    rsTicketsSchedule.ShowFullTime = false;
}

This way the label will show the correct text. Hope this was helpful.

Regards,
Bozhidar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Prava kafle
Top achievements
Rank 1
answered on 15 Jul 2014, 02:51 PM
Thanks, it worked.
Tags
Scheduler
Asked by
Prava kafle
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Prava kafle
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or