I am trying to change the color -- foreground and background -- of the subject that appears in the cells of the scheduler when in MonthView or DayView. The background color is set correctly, but the foreground color is not.
In the web application, this is done in the code behind in one of the event handlers. The values are read from the database (along with other data). A code snippet follows. Note: the format of the string 'style' has data such as this example: 'color:#FFFF00;background-color:#33CCFF;'
// service_request_scheduler_AppointmentDataBound
protected void service_request_scheduler_AppointmentDataBound(object sender, SchedulerEventArgs e) {
DbDataRecord currentAppointmentRecord = e.Appointment.DataItem as DbDataRecord;
if (currentAppointmentRecord != null){
string style = currentAppointmentRecord[(int)AppointmentReaderFields.Style];
if (style != null && style != string.Empty){
int foreColor = Convert.ToInt32(style.Substring(7,6),16);
e.Appointment.ForeColor = Color.FromArgb(foreColor);
int backColor = Convert.ToInt32(style.Substring(32, 6), 16);
e.Appointment.BackColor = Color.FromArgb(backColor);
}
}
I have run this in the debugger and the string is parsed out correctly so that what gets set in the int 'foreColor' is correct. For debugging purposes, I have also replaced this code with a hard coded foreground color of red, and it still renders as the default (black).
Is there a known bug, am I not using this feature as intended, or other explanation?
In the web application, this is done in the code behind in one of the event handlers. The values are read from the database (along with other data). A code snippet follows. Note: the format of the string 'style' has data such as this example: 'color:#FFFF00;background-color:#33CCFF;'
// service_request_scheduler_AppointmentDataBound
protected void service_request_scheduler_AppointmentDataBound(object sender, SchedulerEventArgs e) {
DbDataRecord currentAppointmentRecord = e.Appointment.DataItem as DbDataRecord;
if (currentAppointmentRecord != null){
string style = currentAppointmentRecord[(int)AppointmentReaderFields.Style];
if (style != null && style != string.Empty){
int foreColor = Convert.ToInt32(style.Substring(7,6),16);
e.Appointment.ForeColor = Color.FromArgb(foreColor);
int backColor = Convert.ToInt32(style.Substring(32, 6), 16);
e.Appointment.BackColor = Color.FromArgb(backColor);
}
}
}
I have run this in the debugger and the string is parsed out correctly so that what gets set in the int 'foreColor' is correct. For debugging purposes, I have also replaced this code with a hard coded foreground color of red, and it still renders as the default (black).
Is there a known bug, am I not using this feature as intended, or other explanation?