Hi,
I am trying to set the background colour of each appointment on a WebMonthView according to it's status in code-behind. The relevant lines are being set, but not making any difference to what is displayed on the page. This is my code.
Private Sub WebScheduleInfo1_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebScheduleInfo1.DataBinding Dim appCol As AppointmentsSubsetCollection For Each app As Infragistics.WebUI.WebSchedule.Appointment In Me.WebMonthView1.WebScheduleInfo.Appointments appCol = WebScheduleInfo1.GetAppointmentsForDate(WebScheduleInfo1.ActiveResource, app.StartDateTimeUtc) For Each appt As Infragistics.WebUI.WebSchedule.Appointment In appCol If (appt.Status = 0) Then appt.Style.CustomRules = "background-color:orange !important;" appt.Style.BackColor = Drawing.Color.Orange ElseIf (appt.Status = 1) Then appt.Style.CustomRules = "background-color:cyan !important;" appt.Style.BackColor = Drawing.Color.Cyan ElseIf (appt.Status = 2) Then appt.Style.CustomRules = "background-color:lightgreen !important;" appt.Style.BackColor = Drawing.Color.LightGreen ElseIf (app.Status = 3) Then appt.Style.CustomRules = "background-color:red !important;" appt.Style.BackColor = Drawing.Color.Red End If Next Next End Sub
Is there a setting on the WebMonthView, WebSchedule or WebScheduleGenericDataProvider that would be overriding what I'm doing?
Hello Clyde69 ,
Thank you for posting your solution to our forum.
If you have any further questions regarding this issue I’d be glad to answer them.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Ok, no replies then.
The answer, as it happens, was that the BackColor's were being set properly but because a different resource than the one the Appointments belonged to was selected by default, the new colours were not in use. As soon as the correct Resource was selected, the correct colours were applied.
The fix? To assign all the Appointments to the same Resource, which works in this scenario but isn't the best solution for most jobs.