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

Changing foreground color for subject does not appear to work

3 Answers 58 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 09 Feb 2011, 07:22 PM
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?

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 11 Feb 2011, 03:30 PM
Hi Dan,

I tested the case, but in my local project the ForeColor value applied correctly to the appointment's text.
 
Do you have any external css styles in your page? If yes, can you remove them and try again?


Greetings,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Dirk
Top achievements
Rank 1
answered on 28 Jun 2012, 03:50 PM
I know this is an old post but the issue seems still there.

When you set your foreground color from code it gets correctly applied to the td surrounding the day and the date number (anchor), but the css of the skin you are using overwrites this with a more specific css definition. The solution is to make a css style which forces the <a> element to ignore the color imposed by the skin and "look up" (inherit).

fix:
.yourcalendar .rcRow a
{
    color: inherit !important;
}

EDIT: I just noticed this post is in the scheduler section and not the calendar section (which is what I was googeling for and how I ended up here) but I suspect it is a similar issue and fix if the problem is also still present at the radScheduler.
0
Peter
Telerik team
answered on 03 Jul 2012, 09:47 AM
Hi Dirk,

Thank you for sharing your workaround in the forum.

Please, let us know if you still have any pending unresolved issues.

Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Dan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Dirk
Top achievements
Rank 1
Share this question
or