It is setting all days to the colour (no problem with display) and disabling all of them....it just doesn't make sense! FYI, the code is within the DayRender and I've displayed the whole subroutine in case it's something else!
Thanks for your help.
Private Sub Calendar1_DayRender(sender As Object, e As DayRenderEventArgs) Handles Calendar1.DayRender
Dim DayLoop As Integer = 0
Dim CurrentDay As Integer = 0
For DayLoop = 1 To 7
Select Case DayLoop
Case 1
If Session("StylistDay1") = 1 Then
CurrentDay = DayLoop
Else
CurrentDay = 99
End If
Case 2
If Session("StylistDay2") = 1 Then
CurrentDay = DayLoop
Else
CurrentDay = 99
End If
Case 3
If Session("StylistDay3") = 1 Then
CurrentDay = DayLoop
Else
CurrentDay = 99
End If
Case 4
If Session("StylistDay4") = 1 Then
CurrentDay = DayLoop
Else
CurrentDay = 99
End If
Case 5
If Session("StylistDay5") = 1 Then
CurrentDay = DayLoop
Else
CurrentDay = 99
End If
Case 6
If Session("StylistDay6") = 1 Then
CurrentDay = DayLoop
Else
CurrentDay = 99
End If
Case 7
If Session("StylistDay7") = 1 Then
CurrentDay = DayLoop
Else
CurrentDay = 99
End If
End Select
If (e.Day.Date.DayOfWeek + 1) <> CurrentDay Then
' 'MsgBox((e.Day.Date.DayOfWeek + 1) & " " & CurrentDay)
e.Cell.BackColor = System.Drawing.Color.LightSalmon
e.Day.IsSelectable = False
End If
Next DayLoop
If e.Day.Date.DayOfWeek + 1 = Session("ClosedDay") Then
e.Cell.BackColor = System.Drawing.Color.Firebrick
e.Day.IsSelectable = False
End If
Dim nextDate As DateTime
If Not CType(Session("PublicHolidays"), DataSet) Is Nothing Then
For Each dr As DataRow In CType(Session("PublicHolidays"), DataSet).Tables(0).Rows
nextDate = CType(dr("BankHoliday"), DateTime)
If nextDate = e.Day.Date Then
e.Cell.BackColor = System.Drawing.Color.CornflowerBlue
End If
Next
End If
If Not CType(Session("StylistHolidays"), DataSet) Is Nothing Then
For Each dr As DataRow In CType(Session("StylistHolidays"), DataSet).Tables(0).Rows
nextDate = CType(dr("HolidayDate"), DateTime)
If nextDate = e.Day.Date Then
e.Cell.BackColor = System.Drawing.Color.Red
'e.Cell.Text = "SH"
End If
Next
End If
If e.Day.Date = Today Then
e.Cell.BackColor = System.Drawing.Color.Green
End If
End Sub