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

Change Duration at runtime during timeslotcreated

1 Answer 38 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 11 Apr 2016, 12:14 PM

I am needing to change the duration into the timeslote created event as I am using that to show holidays but i see in the event the duration is readonly when i access that is their anyway to change that at all please.

 

01.protected void apertureAppointments_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
02.      {
03.          int i = 0;
04.          bool isFound = false;
05.          List<tblApertureNetShiftPattern> _list = new List<tblApertureNetShiftPattern>();
06.          _list = _dal.getHolidays();
07.          List<Resource> resources = new List<Resource>(apertureAppointments.Resources.GetResourcesByType("Managers"));
08.          Resource res = resources[5];
09. 
10.          foreach (tblApertureNetShiftPattern sp in _list)
11.          {
12.              if (_list.Count >= 1)
13.                  i++;
14.              else
15.                  i = 0;
16. 
17.              DateTime dt1 = Convert.ToDateTime(_list[i - 1].startdate);
18.              DateTime dt2 = Convert.ToDateTime(_list[i - 1].endDate);
19. 
20.              TimeSpan span = dt2.Subtract(dt1);
21.              if (e.TimeSlot.Start == dt1 && e.TimeSlot.Resource.Text == sp.manager_name)
22.              {
23.                  isFound = true;
24.                  if (DoDateRangesOverlap(e.TimeSlot.Start, e.TimeSlot.End, dt1, dt2) && isFound == true)
25.                  {
26.                      Label temperatureLabel = new Label();
27. 
28.                      if (sp.appointmentType == Constants.shiftDayoff)
29.                      {
30.                          e.TimeSlot.CssClass = "DayOfCssStyle";
31.                          temperatureLabel.CssClass = "DayOfCssStyle";
32.                          temperatureLabel.Text = sp.Description;
33.                      }
34.                      else if (sp.appointmentType == Constants.shiftHoliday)
35.                      {
36.                          e.TimeSlot.CssClass = "HolidayCssStyle";
37.                          temperatureLabel.CssClass = "HolidayCssStyle";
38.                          temperatureLabel.Text = sp.Description;
39.                      }
40.                      else if (sp.appointmentType == Constants.shiftStat)
41.                      {
42.                          e.TimeSlot.CssClass = "statCssStyle";
43.                          temperatureLabel.CssClass = "statCssStyle";
44.                          temperatureLabel.Text = sp.Description;
45.                      }
46.                      else if (sp.appointmentType == Constants.shiftsickDay)
47.                      {
48.                          e.TimeSlot.CssClass = "SickDayStyle";
49.                          temperatureLabel.CssClass = "SickDayStyle";
50.                          temperatureLabel.Text = sp.Description;
51.                      }
52.                      else
53.                          temperatureLabel.Text = "OCCUPIED";
54. 
55.                      Image imageControl = new Image();
56. 
57.                      imageControl.ImageUrl = @"~\images\aperturenet\Calendar\resources\holidays.png";
58. 
59.                      temperatureLabel.BackColor = System.Drawing.Color.Orange;
60. 
61.                      e.TimeSlot.Control.Controls.AddAt(1, temperatureLabel);//add the image
62.                      e.TimeSlot.Control.Controls.AddAt(2, imageControl);
63.                  }
64.              }
65.          }
66.      }

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 14 Apr 2016, 06:19 AM
Hello Philip,

The duration of the time slot cannot be changed as it should be always equal for all time slots within the RadScheduler. Otherwise the control won't display its data properly.

Regards,
Veselin Tsvetanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Scheduler
Asked by
Philip
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or