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

Hide or Block Time Slots

33 Answers 545 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Denis Cilliers
Top achievements
Rank 1
Denis Cilliers asked on 31 Aug 2012, 02:47 PM
Hi
Is there a way to hide or grey out sections of the Scheduler time to prevent appointments being made?

Sort of out of Office type periods or when a resource is not available?

This sort of does things, but it gets a bit messy on the Day and Timeslot overlap.  I watned to try and get a Day to be grayed out.  Sort of if someone was on leave then the day is greyed out entirely like the Saturday and Sunday are.  But I seem to have some bug in the way it is working because the Wednesday keeps being open.

Here is the code so far

Private Sub radSchedulerDemo_CellFormatting(sender As System.Object, e As SchedulerCellEventArgs) Handles radSchedulerDemo.CellFormatting
       'Check Date Block
       Dim dbDateBlocked As Boolean = isDateBlocked(e.CellElement.Date)
       If dbDateBlocked Then
           e.CellElement.Enabled = False
       End If
       If isTimeBlocked(e.CellElement.Date) Then
           e.CellElement.Enabled = False
       End If
   End Sub

Function isDateBlocked(ByVal eDate As Date) As Boolean
       Dim blReturn As Boolean = False
       'Test that the date is not in the range of blocked dates
       'Specific dates
       Dim dtBlock As Date = New Date(2012, 9, 5)
       'No Appointments in the Past
       If dtBlock < DateTime.Today Then
           blReturn = True
       End If
       If eDate.Equals(dtBlock) Then
           blReturn = True
       End If
       'Weekends
       If eDate.DayOfWeek = DayOfWeek.Saturday Then
           blReturn = True
       End If
       If eDate.DayOfWeek = DayOfWeek.Sunday Then
           blReturn = True
       End If
       Return blReturn
   End Function

Function isTimeBlocked(ByVal eDate As DateTime) As Boolean
       Dim blReturn As Boolean = False
       Dim dtBlock As Date = New Date(2012, 9, 5)
       'Check if Day Blocked
       If eDate.Equals(dtBlock) Then
           'Block all slots for this day as a override for any other open slots by default
           Return True
           Exit Function
       End If
       'Working hours Mon - Friday
       'Block Slots 
       '   0:00 - 8:00
       Dim tsDayStart As New TimeSpan(0, 0, 0)
       Dim tsWorkStart As New TimeSpan(8, 0, 0)
       Dim tsWorkStartLate As New TimeSpan(10, 0, 0)
       '   12:00-13:00
       Dim tsLunchStart As New TimeSpan(12, 0, 0)
       Dim tsLunchEnd As New TimeSpan(13, 0, 0)
       '   17:00-24:00
       Dim tsWorkEndEarly As New TimeSpan(15, 0, 0)
       Dim tsWorkEnd As New TimeSpan(17, 0, 0)
       Dim tsWorkEndLate As New TimeSpan(19, 0, 0)
       Dim tsDayEnd As New TimeSpan(23, 59, 59)
       Select Case eDate.DayOfWeek
           Case DayOfWeek.Monday
               If eDate.TimeOfDay >= tsDayStart AndAlso eDate.TimeOfDay < tsWorkStart Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsLunchStart AndAlso eDate.TimeOfDay < tsLunchEnd Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsWorkEnd AndAlso eDate.TimeOfDay <= tsDayEnd Then
                   blReturn = True
               End If
           Case DayOfWeek.Tuesday
               If eDate.TimeOfDay >= tsDayStart AndAlso eDate.TimeOfDay < tsWorkStart Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsLunchStart AndAlso eDate.TimeOfDay <= tsLunchEnd Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsWorkEnd AndAlso eDate.TimeOfDay <= tsDayEnd Then
                   blReturn = True
               End If
           Case DayOfWeek.Wednesday
               'Late working day
               If eDate.TimeOfDay >= tsDayStart AndAlso eDate.TimeOfDay < tsWorkStart Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsLunchStart AndAlso eDate.TimeOfDay < tsLunchEnd Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsWorkEndLate AndAlso eDate.TimeOfDay <= tsDayEnd Then
                   blReturn = True
               End If
           Case DayOfWeek.Thursday
               'Late Start of Day
               If eDate.TimeOfDay >= tsDayStart AndAlso eDate.TimeOfDay < tsWorkStartLate Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsLunchStart AndAlso eDate.TimeOfDay < tsLunchEnd Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsWorkEnd AndAlso eDate.TimeOfDay <= tsDayEnd Then
                   blReturn = True
               End If
           Case DayOfWeek.Friday
               'Early Working end
               If eDate.TimeOfDay >= tsDayStart AndAlso eDate.TimeOfDay < tsWorkStart Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsLunchStart AndAlso eDate.TimeOfDay < tsLunchEnd Then
                   blReturn = True
               End If
               If eDate.TimeOfDay >= tsWorkEndEarly AndAlso eDate.TimeOfDay <= tsDayEnd Then
                   blReturn = True
               End If
           Case DayOfWeek.Saturday
               blReturn = True
           Case DayOfWeek.Saturday
               blReturn = True
       End Select
       Return blReturn
   End Function

33 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Todorov
Telerik team
answered on 04 Sep 2012, 10:27 AM
Hello Denis,

Thank you for contacting us.

Please note that e.CellElement.Date contains the exact DateTime that a given cell represents. This means that the value of this property also includes a time part and the eDate.Equals(dtBlock) will return False if the time parts differ. Therefore, to overcome this, you should get only the date part of a cell's date when comparing for dates. Also, you should reset the properties that you are setting on the CellFormatting event if the used condition does not match. This is needed because the cell elements are sometimes reused to display other dates in other views and you should explicitly set Enabled = True in all cases in which your conditions are not met. The following code snippet demonstrates how to modify your CellFormatting handler in order to get this working as expected:
Private Sub radSchedulerDemo_CellFormatting(sender As System.Object, e As SchedulerCellEventArgs) Handles radSchedulerDemo.CellFormatting
    'Check Date Block
    Dim dbDateBlocked As Boolean = isDateBlocked(e.CellElement.Date.Date) 'compare only the Date part of e.CellElement.Date
    If dbDateBlocked Then
        e.CellElement.Enabled = False
        Return
    End If
    If isTimeBlocked(e.CellElement.Date) Then
        e.CellElement.Enabled = False
        Return
    End If
 
    e.CellElement.Enabled = True 'reset the Enabled property back to True
End Sub

I hope you find this useful. Feel free to ask if you have any additional questions.

Greetings,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 10 Sep 2012, 09:21 AM

HI,
Please help me to evaluate the telerik version 2012 as to give a purchase decission to my company ,
Our customer need a scheduler to  time scale ruler to step every 2 hours  (skip one hour between each time and the next)
or to make this row(9,11,13,15,17) height =0 so it wiil seem that it doesn't exist as follow:

8
10
12
14
16
18


Best Regards
0
Ivan Todorov
Telerik team
answered on 11 Sep 2012, 11:09 AM
Hi Khaled,

Thank you for your question.

Currently, RadScheduler can only be set with ruler step of at most 1 hour. I have logged your request in our Public Issue Tracking System so it is publicly available to all users. Here you can find the PITS item: http://www.telerik.com/support/pits.aspx#/public/winforms/12607.You can vote for it to increase its priority or subscribe to it to track it for any progress. As it gets more votes, we will consider implementing it a future release.

Your Telerik points have been updated for your feature request.

Should you have any further questions, do not hesitate to contact us.

Regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 12 Sep 2012, 02:06 PM
HI ,
Thanks for Reply , Our Customer will accept this for now hopping to be modefied as soon as possible

Another Issues that  gives me errors when i try to use it
1-Issue that I want to use or create  events for existing fields in Appointment Edit Dialog screen.
for example the--> (value changed event) for Start Date Time Picker
-->or event click for the OK button
however in visual studio design time ,
 when I seleck Ok button in Appointment Edit Dialog screen(telerik winform)  for example and open Properties window and select the lightening sign to show events possible I found many but when use the error occur ,
So please tell me steps to use these events

2- also I want to know the way where I can make the tool tip shows start and end time plus subject for all appointments on the scheduler


Best Regards , thanks for your cooperation

0
Ivan Todorov
Telerik team
answered on 14 Sep 2012, 12:39 PM
Hello Khaled,

I am not sure why you are getting errors when trying to subscribe to the events of the edit dialog in the designer. I was not able to observe such issue on my end. Nevertheless, you should be able to subscribe to the events programmatically as demonstrated below:
public class MyEditDialog : EditAppointmentDialog
{
    public MyEditDialog()
    {
        this.buttonOK.Click += new EventHandler(buttonOK_Click);
    }
 
    void buttonOK_Click(object sender, EventArgs e)
    {
         
    }  
}

As to modifying the default tooltip text of the appointments, you can use the AppointmentFormatting event to achieve this:
void radScheduler1_AppointmentFormatting(object sender, Telerik.WinControls.UI.SchedulerAppointmentEventArgs e)
{
    e.AppointmentElement.ToolTipText = "From: " + e.Appointment.Start.ToShortDateString() + " To: "
        + e.Appointment.End + " Summary: " + e.Appointment.Summary;
}

I hope this will help you. Do not hesitate to ask if you have any additional questions.

Greetings,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Denis Cilliers
Top achievements
Rank 1
answered on 14 Sep 2012, 02:47 PM
Two slight refinements to the code above

Need to add a check for the Zero time used to display days in Month View and Timeline View, else the whole day is greyed out

'Check if Time Sent is '00:00
       Dim zerotime As DateTime = New Date(0)
       If eDate.TimeOfDay.Equals(zerotime.TimeOfDay) Then
           Return False
       End If

And added an event to check for the Weekend in the WeekView very useful

Private Sub rsnMain_WeekViewClick(sender As System.Object, e As System.EventArgs) Handles rsnMain.WeekViewClick
       Me.btnChangeTimeSlots.Visible = True
       'Set Week Defaults
       Dim weekView As SchedulerWeekView = Me.radSchedulerDemo.GetWeekView()
       weekView.ShowWeekend = False
   End Sub

Else the scheduler is looking rather good... :)
I need to go make a Custom Dialog now ;(
0
Khaled
Top achievements
Rank 1
answered on 16 Sep 2012, 12:04 PM
Hi,

All worked fine , thanks for your time and great support ,your answers helps alot
the final question is -->when I load Scheduler I group by resources (all data are from MSsql) , Resources Backcolor are Darkgrey and its forecolor are black so its not clear atall ,
even if i changed the schedule theme the resources  color stays grey
I tried the following code but its not working in the load it may work in a  button click after load
 ,so the first impression to customer that resources are unreadable till he click on the button


Dim
i As Integer

Dim colors() As Color = {Color.LightBlue, Color.LightGreen, Color.LightYellow, Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue}

 

For Each r As Resource In RadScheduler1.Resources

i += 1

r.Color = colors(i)

Next

 Best Regards

 

 

 

 

 

 

 

 

 

 

 

 

 

0
Ivan Todorov
Telerik team
answered on 17 Sep 2012, 02:04 PM
Hello Khaled,

The code you have posted is correct and it should apply the different colors to the corresponding resources. Please make sure that the resources are already populated at the moment you assign the colors (i.e. you have already set the datasource to RadScheduler and filled the data tables by calling the Fill method of their table adapters). For example, you can try assigning the colors on the Shown event of the form.

I hope this will help. Please let me know if you need any further assistance.

Regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 20 Sep 2012, 08:32 AM
Hi,
    Thanks alot All are fine , with your help all problems solved till now,
there is another 2 Question
 1-about preventing drag and drop in holidays
-now what i managed to do is to allow drag and drop in holidays then loop on all appointments if there is an appointment with

For Each a As Appointment In RadScheduler1.Appointments

a.start.Dayofweek.tostring ="Sunday" i prevent save

-but will be better to prevent drag and drop the appointment in holidays

2- Also I want to get the AppointmentID for the selected Appointment ,which event could I use


Best Regards

 

 

 

0
Ivan Todorov
Telerik team
answered on 21 Sep 2012, 01:22 PM
Hi Khaled,

You can handle the AppointmentDropping event to check if new target date is a holiday and cancel the drop if needed:
Private Sub radScheduler1_AppointmentDropping(sender As Object, e As AppointmentMovingEventArgs) Handles radScheduler1.AppointmentDropping
    If e.NewDate.DayOfWeek = DayOfWeek.Saturday OrElse e.NewDate.DayOfWeek = DayOfWeek.Sunday Then
        e.Cancel = True
    End If
End Sub

Feel free to ask if you have any additional questions.

Regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 23 Sep 2012, 03:34 PM
Hi ,

     till now all are going well with your help , wishing the following 4 questions will be the last
1- if we bought 2012 version will we obtain a liscence so that we will be able to develop programs using telerik and sell it to our customers legaly , as my company owner want to confirm about this
2-ColorCoding for time slots to set
-->Set any clor for working times ,example from (8AM till 2PM) then (4PM till PM) 
3-->Set different color for Break times (2PM till 4PM)
-can i make in the dayview the resources on the vertical access and the time the horizontal
4- in the appointments table I added an integer column "X"  i want to pass this column to the schedulerbindingsource ,
but what i think is that field like description in SchedulerBindingDatasource accepts string only as when i assign to it a string i managed to call its value in runtime but when assign integer column "X" I couldn't use it in run time the value is ""

Regards ,
Khaled
0
Ivan Todorov
Telerik team
answered on 26 Sep 2012, 03:07 PM
Hi Khaled,

Yes, if you purchase a license for RadControls, you can create and sell software that contains our components as long as you deploy your application in accordance with our license agreement. Please refer to the following documentation article where you can find the permitted ways to deploy your application: http://www.telerik.com/help/winforms/installation-deployment-and-distribution-redestributing-telerik-radcontrols-for-windows.html

As to your question about coloring the cells, to apply conditional colors you can use the CellFormatting event of RadScheduler. The following code snippet demonstrates a sample implementation:
Private Sub radScheduler1_CellFormatting(sender As Object, e As Telerik.WinControls.UI.SchedulerCellEventArgs) Handles radScheduler1.CellFormatting
    If e.CellElement.[Date].Hour >= 12 AndAlso e.CellElement.[Date].Hour <= 14 Then
        e.CellElement.BackColor = Color.Green
    ElseIf e.CellElement.IsWorkTime Then
        e.CellElement.BackColor = Color.Red
    Else
        e.CellElement.ResetValue(SchedulerCellElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local)
    End If
End Sub

As to the orientation of resources/time scale in grouped DayView, it cannot be modified. However, you can use the TimelineView which arranges the resources vertically and the timescale horizontally. You can check the Grouping example in our Examples application. I have also attached a screenshot which demonstrates this.

In regards to your forth questions, I am not sure I completely understand your scenario. Generally, you can map any custom column of your database to any custom field of your appointment and the following help article explains how you can achieve this: http://www.telerik.com/help/winforms/scheduler-data-binding-binding-to-custom-fields.html. Also, if you need to do some type conversion between the data in the datasource and the fields of the appointments (for example, convert the integer column X to the string field Description and vice versa) you can use conversion abilities of the scheduler mapping. This is demonstrated in the following help article: http://www.telerik.com/help/winforms/scheduler-data-binding-scheduler-mapping.html

A bit off-topic, I would kindly ask you to open new threads for questions that are not related to the original topic of the current thread. This will help us track your questions better and provide you with quicker responses. Also, it will help other user with the same questions find their answers more easily.

Thank you for your understanding. If you have further questions, do not hesitate to ask.

Kind regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 01 Oct 2012, 01:01 PM
Hi ,
    thanks alot for your reply,it is highly appreciated and the one of the most valuable element in my company's purchase decession,
-->concerning Cell formatting event and appointment dropping will help me in many cases
-->I got 3 question concerning Timeline with the hours scale on horizontal axis and resources on vertical axis:

q1- if i got six appointments for the resource1 and i show on the horizontal axis 10 resources , around 3 appointments only will be visible and the other will be hidden , why don't they auto shrink, and how user can see them(example is in the attachment)

q2-if i wantthe code that do ( rightclick in on the horizontal axis in the timeline tab and select hours instead of days as your previous attachment)

q3-as you can see in my attachment the horizontal axis in the timeline view is divided in to around 6 time slots
per each page , in the first from 00 till 05 in second from 06 till 12 .....etc,
what i need here is to maket it for example 10 time slots instead of 6
as page 1 to start at 00 and ends at 10 and page 2 starts at 11and ends at at 20 ...etc

-->or make all hours in 1 page from 00 till 24

0
Khaled
Top achievements
Rank 1
answered on 01 Oct 2012, 06:53 PM
-->Also if i use minutes to be my range factor as follow

dayView.RangeFactor = 1

-->then i want each 1 minute row to have a smaller height so i tried the following but doesn't work

dayView.RulerScaleSize = 10

so the question is how to control row height by code


0
Ivan Todorov
Telerik team
answered on 02 Oct 2012, 02:27 PM
Hello Khaled,

I am glad I was able to help.

As to your new questions, when there are more appointments than a row in TimelineView can hold, a small scroll bar should appear at the end of that row (as shown on the attached screenshot). Auto-shrink is not supported because this would make the text of the appointments unreadable.

In regards to the second question, you can set the scaling programmatically using the following code:
this.radScheduler1.GetTimelineView().ShowTimescale(Timescales.Hours);

As to the third question, you can modify the number of displayed cells using the following property:
this.radScheduler1.GetTimelineView().GetScaling().DisplayedCellsCount = 10;

In regards to your last question, this is the correct way to modify the row height and it works correctly on my end:
this.radScheduler1.GetDayView().RangeFactor = (ScaleRange)1;
this.radScheduler1.GetDayView().RulerScaleSize = 10;

However, please note that setting the RangeFactor to 1 will cause RadScheduler to create thousands of cell elements which will significantly decrease the performance.

I hope I was able to answer your questions. If you continue experiencing difficulties, you can open a new support ticket and send us a sample project which demonstrates your current approach. This will let us investigate it and provide you with proper support.

Greetings,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 04 Oct 2012, 08:19 AM
Hi ,
     All were fine thanks alot , I will show Owners how things are meeting there customer need and purchase 2012 version 



Best Regards
Khaled
0
Khaled
Top achievements
Rank 1
answered on 04 Oct 2012, 01:51 PM
Hi ,
all your previous solution worked fine except that concerning the scroll on the right you showed me in your previous attachment  it doesn't show when appointments per resource increase than the row height in timelineview ,

shall i need a code like the following to let the scroll show or it shows automatically          
Dim TMvW As SchedulerTimelineView = RadScheduler1.GetTimelineView

TMvW.AllowResourcesScrolling = True

 TMvW.AllowAppointmentResize() = True

please help ,i tried this with no hope , and I want to show the owners the demo that makes all their dreams come true , but why this is not working however i installed your final version demo and working on it
but no scroll appears is there is a certain property to set it for the scheduler or what??

here i reattached your previous attachment(scroll at right.png ) , and anothe attachment(Scheduler Prob.Jpg) for what i have

Best Regards in Advance
Khaled

 

 


0
Ivan Todorov
Telerik team
answered on 05 Oct 2012, 03:11 PM
Hello Khaled,

It appears that there is an issue in the Breeze theme which is preventing the scroll bars from appearing. We will address this issue in the next official release which is expected by the end of the month. For the time being, I am sending you a modified version of the Breeze theme which will allow the scrollbars to appear. Sample project is also included. Note that in order to be able to load the package file, its build action must be "Embedded resource". More information about loading custom themes can be found in the following help article.

Your Telerik points have been updated for bringing this issue to our attention. Should you have any additional questions, do not hesitate to ask.

All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 05 Oct 2012, 07:20 PM
Hi ,

  Thanks for reply
-->So to get the Breeze theme working I have to purchase on the first of November not before.
-->Also I will try Your attachment and feed you back

-->Note that you may put in consideration when I changed the row height in the dayview by code ruler Scale Size ,It doesn't work till I go to week or timeline view then get back to day view by code as follow and the the row height modification shows :

 

Me.RadScheduler1.ActiveViewType = SchedulerViewType.WorkWeek

 

Me.RadScheduler1.ActiveViewType = SchedulerViewType.Day

is this about the breeze i may try without , but the breeze color suits our application most so if will be fixed we will by that fixed one


Best Regards
Khaled
0
Khaled
Top achievements
Rank 1
answered on 07 Oct 2012, 11:28 AM
Hi ,
I embeded the Breeze modified theme successfuly with your helpful sent materials ,i showed the owners a demo , All was great , their only comment was :
--> When I increase number of resources per view  the resource names couldn't be fully dispalyed could we have the ability to wrap resources text Header in the Timeline View as attached
-->In the day view i can set start and end time on the ruler as folow
Me.RadScheduler1.GetDayView.RulerStartScale = 8
Me.RadScheduler1.GetDayView.RulerEndScale = 13

But if i witched to timeline view and make the Timescale to show by hours, how could I set the starting hour and ending hour like on the Dayview

 

 


Best regards
Khaled
0
Ivan Todorov
Telerik team
answered on 08 Oct 2012, 02:43 PM
Hi Khaled,

The text of the resource headers cannot be wrapped if it is vertically oriented. However, you can change the orientation of the text to horizontal and then use the CellFormatting event to set TextWrap to the cells. You can also modify the resources' width so that it is wide enough to display the text properly.

As to your second question, the TimelineView displays dates/times continuously and to modify the start time, you should set the StartDate property of the current view with an exact DateTime. To modify the number of cells displayed, you can use the DisplayedCellsCount property as discussed in a previous message.

I am attaching a sample project to demonstrate these. I hope you find it useful.

Should you have any additional questions, do not hesitate to ask.

Regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 08 Oct 2012, 07:29 PM
Hi ,
thanks this project sample was perfect , my last question is

1-If  I want to use the cell formatting to
  --> shade cells by red on (Date 22/09/2012) , on (time  between 10 to 13) , for the (resource "Alan Smith")
  --> shade cells by Green on (Date 22/09/2012) , on (time  between 08 to 18) , for the (resource "Anne Dodsworth")

I tried doing this but no hope , so please help

Best Regards,
Khaled
0
Ivan Todorov
Telerik team
answered on 10 Oct 2012, 02:55 PM
Hi Khaled,

You can get all the information you need from the cell in order to determine the back color. The following code sample demonstrates this:
Private Sub RadScheduler1_CellFormatting(sender As Object, e As SchedulerCellEventArgs)
    Dim resourceName = ""
     
    If e.CellElement.View.GetResources() IsNot Nothing Then
        resourceName = e.CellElement.View.GetResources()(0).Name
    End If
     
    Dim targetDate as New DateTime(2012, 09, 22)
 
    If e.CellElement.Date.Date = targetDate AndAlso e.CellElement.Date.Hour >= 10 AndAlso e.CellElement.Date.Hour <=13 AndAlso resourceName = "Alan Smith" Then
        e.CellElement.BackColor = Color.Red
    ElseIf e.CellElement.Date.Date = targetDate AndAlso e.CellElement.Date.Hour >= 08 AndAlso e.CellElement.Date.Hour <=18 AndAlso resourceName = "Anne Dodsworth" Then
        e.CellElement.BackColor = Color.Green
    Else
        e.CellElement.ResetValue(SchedulerCellElement.BackColorProperty, ValueResetFlags.Local)
    End If
 
End Sub

Please let me know if you have any additional questions.

Regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Khaled
Top achievements
Rank 1
answered on 05 Nov 2012, 12:47 PM
Hi,
our scheduler was under test using our data for along time all are ok but 2 needs occured
1- In the resources Timelineview as in (attacment 1)
 -->i want to display the image stretched plus the name of the resource
-->also is it possible to or fix the image height and width while it is stretched
-->is it possible to put the image in a frame and if possible so how this could be done
2- I want to hide the scheduler  horizontal scroll as in (attachment 2)
 
Best Regards and always thankful for cooperation
Khaled
0
Ivan Todorov
Telerik team
answered on 07 Nov 2012, 01:36 PM
Hi Khaled,

You can change the ImageLayout property of the resource cells using the CellFormatting event. As to putting a frame to the image, this should be done in the image itself. In regards to hiding the horizontal scrollbar, there is a single property that sets this. I am attaching a small sample project which demonstrates the discussed features.

A bit off-topic, I would like to remind you that your trial support package has expired. If you would like to continue receiving support from us, you will have to consider a purchase of some of the licenses that we offer. In case your company has already purchased the product, please ask the purchase holder to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: http://www.telerik.com/account/faqs.aspx.

Feel free to ask if you have any questions.

Regards,
Ivan Todorov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Khaled
Top achievements
Rank 1
answered on 12 Nov 2012, 06:35 AM
Hi,

Owners decided to buy the latest Telerik stable  Version 
So please advise which version is suitable shall we work with Q2 2012 or get Q3
Also what about the price
Note
====
1-in your comment -->Posted on Oct 5, 2012 on this page you mentioned that there are some telerik points that may give a disount bon your product
2-Our used version of visual studio is:
Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel
Microsoft .NET Framework
Version 4.0.30319 RTMRel

Best Regards,
Khaled
0
Ivan Todorov
Telerik team
answered on 13 Nov 2012, 02:32 PM
Hi Khaled,

I suggest using the latest version as with each new release we improve our product and address issues that were present in the previous releases. When you purchase a license, you will receive access to the current Telerik version as well as all Telerik versions that will be released during your subscription. Additionally, upon request we can provide you with older versions as well.

As to the Telerik points, yes, you can redeem them as a discount to your purchase. You can read more about Telerik points here: http://www.telerik.com/telerik-points.aspx. For a list of available purchase options, please visit this link: http://www.telerik.com/purchase.aspx.

For any further questions regarding the purchase, please contact sales@telerik.com.

Kind regards,
Ivan Todorov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Chan
Top achievements
Rank 1
answered on 10 Jul 2013, 06:35 AM
Helo !
As per requirement, I need to display appointments for 14 days on Radscheduler without weekends.
 tried with weekview but that is displaying only 1 week view.
I tried Dayview with daycount as 14, that displays 14 days but displaying saturday and sunday as well.
I tried MultidayView as well, but not getting idea to hide weekends.
Here is my code snippet :

private void FormAppointment_Load(object sender, EventArgs e)
        {
            SetRadScheduler();
        }
 
        private void SetRadScheduler()
        {
            SchedulerDayView dayView = new SchedulerDayView();
            dayView.DayCount = 14;
            this.radScheduler1.ActiveView = dayView;
 
            //SchedulerWeekView weekView = new SchedulerWeekView();
            //weekView.DayCount = 3;
            //weekView.ShowWeekend = false;
            //this.radScheduler1.ActiveView = weekView;
 
            //radScheduler1.ActiveViewType = SchedulerViewType.Month;
            //(radScheduler1.ActiveView as SchedulerMonthView).WeekCount = 2;
 
            //radScheduler1.ActiveViewType = SchedulerViewType.WorkWeek;
            //(radScheduler1.ActiveView as SchedulerWeekView).DayCount = 12;
        }
 
 private void radScheduler1_CellFormatting(object sender, SchedulerCellEventArgs e)
 {
 if (e.CellElement.Date.DayOfWeek == DayOfWeek.Saturday || e.CellElement.Date.DayOfWeek == DayOfWeek.Sunday)
 {
   //e.CellElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
  //e.CellElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
    e.CellElement.Enabled = false;
 }
 else
 {
  //e.CellElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
    e.CellElement.Enabled = true;
// e.CellElement.Size = e.CellElement.DefaultSize;
 }
}

Snapshot of current output : where i want to hide saturday and sunday
0
Peter
Telerik team
answered on 11 Jul 2013, 03:01 PM
Hello Chan,

Thank you for writing.

Our RadScheduler does not offer property to hide the weekends in MultiDayView and in DayView. However, you can achieve the desired functionality by using the MultiDayView, where you can set ranges of dates you want to show e.g. one range from 07.07 to 12.07 and another range from 15.07 to 20.07. For more information about this please, refer to this help article.

I hope you find this useful.

Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
tom
Top achievements
Rank 1
answered on 26 May 2014, 08:43 PM
I am using DayView with resource grouping on my scheduler. I need to be able to loop through all resources and grey out an entire day for a resource who is not working that day. ie I have 3 employees(resources), they schedule displays 3 days in day view(mon, tues, wed). Employee 2  is on vacation on Tuesday.  OR I would even be happy with display text in day header for  Tuesday that says "VACATION"

 Can you help me.  I have tried  various solutions here related to looping through cells but they don't seem to address groups by resource structure.

Thanks!

Tom
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 May 2014, 10:51 AM
Hello Tom,

Thank you for writing.

It is appropriate to use the CellFormatting event and change the style for the desired CellElement. Here is a sample code snippet, demonstrating how to disable all cells for a specific date and for a specific resource only:
public Form1()
{
    InitializeComponent();
 
    Color[] colors = new Color[]
    {
        Color.LightBlue, Color.LightGreen, Color.LightYellow,
        Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue
    };
 
    string[] names = new string[]
    {
        "Alan Smith", "Anne Dodsworth",
        "Boyan Mastoni", "Richard Duncan", "Maria Shnaider"
    };
 
    for (int i = 0; i < names.Length; i++)
    {
        Resource resource = new Resource();
        resource.Id = new EventId(i);
        resource.Name = names[i];
        resource.Color = colors[i];
        this.radScheduler1.Resources.Add(resource);      
    }
    this.radScheduler1.GroupType = GroupType.Resource;
    this.radScheduler1.GetDayView().ResourcesPerView = 2;
}
 
private void radScheduler1_CellFormatting(object sender, Telerik.WinControls.UI.SchedulerCellEventArgs e)
{
    if (e.CellElement.Date.Month == 5 && e.CellElement.Date.Day == 30 &&
        e.CellElement.View.GetResources() != null && e.CellElement.View.GetResources().Count > 0 &&
        e.CellElement.View.GetResources()[0].Name == "Anne Dodsworth")
    {
        if (!(e.CellElement is SchedulerHeaderCellElement))
        {
            e.CellElement.Enabled = false;
        }
    }
    else
    {
        if (!(e.CellElement is SchedulerHeaderCellElement))
        {
            e.CellElement.ResetValue(VisualElement.EnabledProperty, ValueResetFlags.Local);
        }
    }
}

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
tom
Top achievements
Rank 1
answered on 29 May 2014, 02:22 PM
Thank you this is very helpful and will solve my issue for color coding entire day. If I understand correctly this event fires every time the cell is created or used?
That tells me that this logic gets processed many times per scheduler display (ie once per cell)? Which is fine when I am coloring an entire day.

Sometimes I know exactly what resource and what date and I want to format ONLY the header cell on that date.  Without using the CellFormatting event, is there a way to directly address a specific header cell for that one date. im sure the answer is here using a collection  I just can't see it! Maybe SchedulerDayViewElement?

Since I have to do a DB read to find my dates off, I want to minimize the reads to one per resource and then directly address that header cell for that one date.

Hope this makes sense/ Thank you so much!

Tom
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 03 Jun 2014, 08:50 AM
Hello Tom,

Thank you for writing back.

The CellFormatting event is fired after a SchedulerCellElement has been created, and when this cell needs to be displayed or refreshed. Note that RadScheduler uses element recycling in order to deliver better performance, hence it is not suitable to access directly a certain cell and customize it, because later it may contain data for another resource as it is being reused. That is why the appropriate way to customize a specific cell for a desired resource is to use the CellFormatting event. Here is a slight modification of the previous code example in order to customize only the SchedulerHeaderCellElement for the desired resource:
private void radScheduler1_CellFormatting(object sender, Telerik.WinControls.UI.SchedulerCellEventArgs e)
{
    if (e.CellElement is SchedulerHeaderCellElement)
    {
        if (e.CellElement.Date.Month == 6 && e.CellElement.Date.Day == 4 &&
            e.CellElement.View.GetResources() != null && e.CellElement.View.GetResources().Count > 0 &&
            e.CellElement.View.GetResources()[0].Name == "Anne Dodsworth")
        {
            e.CellElement.BackColor = Color.Red;
        }
        else
        {
            e.CellElement.ResetValue(VisualElement.BackColorProperty, ValueResetFlags.Local);
             
        }
    }
}

In addition, I would recommend you to extract holidays data from the database in advance in order to avoid performance problems when extracting data in the CellFormatting event.

I hope this information helps. If you have any additional questions, please let me know.  

Regards,
Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Scheduler and Reminder
Asked by
Denis Cilliers
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Khaled
Top achievements
Rank 1
Denis Cilliers
Top achievements
Rank 1
Chan
Top achievements
Rank 1
Peter
Telerik team
tom
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or