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

Change Day Color or Hide Day based on date.

2 Answers 30 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 2
Allan asked on 22 Aug 2011, 11:29 PM
I have a request to change the color of days and make the days read-only based on today's date plus 10 days.

For example, today is August 22, I would like to change the color of days (or hide them) and make them read-only from September 1st back.

(August 22 + 10 days = Sept 1st)

Is this possible?

Thank you in advance.

2 Answers, 1 is accepted

Sort by
0
Ivan Zhekov
Telerik team
answered on 24 Aug 2011, 08:07 AM
Hi Allan,

It's quite possible.

All you need to do is define your date range (like you mentioned today plus 10 days) and add class names / manipulate styles directly to change the colours / hide the cells.

However, hiding the cells with CSS is not recommended, as it may lead to unwanted behaviour of the scheduler. Instead, all such actions should be performed in the backend and the days you want to hide should be filtered out from the data source.

All the best,
Ivan Zhekov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Allan
Top achievements
Rank 2
answered on 24 Aug 2011, 04:29 PM
Here is the solution I found that works for me.


Protected Sub RadScheduler1_TimeSlotCreated1(sender As Object, e As Telerik.Web.UI.TimeSlotCreatedEventArgs) Handles RadScheduler1.TimeSlotCreated
    If e.TimeSlot.Start.CompareTo(DateTime.Now.AddDays(+10)) = -1 Then
        'e.TimeSlot.CssClass = "Custom"
        e.TimeSlot.Control.Controls.Clear()
    End If
End Sub

You can either define a custom CSS to color the background, or like I chose, just hide the day altogether.

Allan
Tags
Scheduler
Asked by
Allan
Top achievements
Rank 2
Answers by
Ivan Zhekov
Telerik team
Allan
Top achievements
Rank 2
Share this question
or