Hi guys,
I've been dealing this issue for some time now and decided to have another stab at it. I can color code appointments in WebDayView using the following code:
protected void WebScheduleInfo1_DataBinding(object sender, System.EventArgs e) { Appointment cApp; foreach ( cApp in WebScheduleInfo1.Appointments) { cApp.Style.CustomRules = "background-color:red; border: solid 1px; black;"; } }
The problem is its not working when an appointment is a recurring one. Please help me Infragistics!!
Thanks
I found out, for anyone running into this same issue, that you have to set the: EnableSmartCallbacks="False" in the control in order to keep the styles when scrolling from week to week or month to month, etc
Ok, I thought it was working like a charm.... If i'm on the Dayview for today and there's an appointment with the back color = blue let's say. Then I scroll the day view back to yesterday to view and then back to today...the color of today's appointment is different, like pink now instead of the correct blue color. Scrolling back or forward (using the previous and next arrows) through the views be it day/week/ or month seems to randomly change the colors.
Thanks so much ~ I had tried it in the databinding event and it wasn't working, but I didn't have the handles.
Working like as charm now :)
the code should be on the data binding event of the WebScheduleInfo. you are only doing it on the Page_Load event
protected void WebScheduleInfo1_DataBinding(object sender, System.EventArgs e) { //color code appointment AppointmentsSubsetCollection appts = WebScheduleInfo1.GetAppointmentsForDate(WebScheduleInfo1.ActiveResource, WebScheduleInfo1.ActiveDayUtc);
foreach(Appointment cApp in appts) { cApp.Style.CustomRules = "background-color:#FFEE24 !important;"; }
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim thisDay As Date = DateTime.Now
images.Text = "<a href='rptAppbyDate.aspx' title='Go to reports'>Reports</a> <a href='DayView.aspx' title='Go to Daily View'><img src='Images/cal_day.gif' style='border-style: none'/> Day</a> <a href='WeekView.aspx' title='Go to Weekly View'><img src='Images/cal_week.gif' style='border-style: none'/> Week</a> <a href='Test.aspx' title='Go to Monthly View'><img src='Images/cal_month.gif' style='border-style: none'/> Month</a> <a href='NewDayLife.aspx' title='Go Home'><img src='Images/home.gif' style='border-style: none'/></a> FILTERS "
day.Text = thisDayofWeek
today.Text = fulldate
While currentDate <> stopDate
If Not IsNothing(appts) Then
Dim fcActivity1 As New myActivity
fcActivity1.getItem(cApp.DataKey)
If Not IsNothing(fcActivity1.Style) Then
cApp.Style.BackColor = colConvert.ConvertFromString(fcActivity1.Style)
Else
End If
Next
currentDate = currentDate.AddDays(1)
End While
' Retrieves the root address for the styles
Dim stylesRoot As String = ConfigurationManager.AppSettings("WebScheduleStyleSheetPath")
Me.inSchedInfo_Month.ActiveResourceName = "Unassigned"
If Not Page.IsPostBack Then
inSchedInfo_Month.ActiveDayUtc = SmartDate.UtcNow