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

RadCalendar - Forecolor

7 Answers 157 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 09 Nov 2011, 10:12 PM
Hi,

I am having a RadCalendar, need to set forecolor for each  different days. In a month calendar, Holidays  are in red forecolor, sunday are in brown color,  some specific day in Green color(15,20, 23...). Need to do it in _DayRender or any other event in code-behind. If i go to next month, it has to display. Also, if i select a day, it has get the data from database and display the values in grid or text controls.  Tried some of the demo's/forums, not getting solution for this.

regards
Jay

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Nov 2011, 10:27 AM
Hello Jay,

Check the following code library and follow the same approach.
Disabling calendar days

Thanks,
Princy.
0
Jay
Top achievements
Rank 1
answered on 10 Nov 2011, 01:26 PM
Thank you Princy. It's on disabling calendar days. Its really useful.

Can you give the server code for change the forecolor of the calendar for only few days like 12,18,27.. (ie based on data from database). I  tried but not getting output.

 protected void calDate_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
    {
Code 1:

        DateTime CurrentDate = e.Day.Date.AddDays(1);    
        e.Cell.ForeColor = System.Drawing.Color.Brown; -- NOT working
        e.Cell.BackColor = System.Drawing.Color.LimeGreen; -- Working

Code 2:

        TableCell currentCell = e.Cell;
        currentCell.Style["background-color"] = "DarkOrange"; -- Working
        currentCell.Style["forecolor"] = "red";  -- NOT Working
}.

Please give me solution as soon as possible.
regards
Jay

0
Mira
Telerik team
answered on 14 Nov 2011, 05:14 PM
Hello Jay,

The described functionality is a bug in the RadCalendar.
I have reported it to our developers and they will work on fixing it for future releases of the RadCalendar for ASP.NET AJAX.

Best wishes,
Mira
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
0
Jay
Top achievements
Rank 1
answered on 14 Nov 2011, 07:56 PM
Hi Mira,

Thanks for your information. Is any other alternate way to get the forecolor in Calendar days ( From server code for change the forecolor of the calendar for only few days like 8,12,18,27).

regards
Jay
0
Mira
Telerik team
answered on 16 Nov 2011, 04:30 PM
Hello Jay,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

I hope it helps.

All the best,
Mira
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
0
Jay
Top achievements
Rank 1
answered on 16 Nov 2011, 07:35 PM
Thanks Mira,

Your solution works for whole calendar of the month. But i am looking for specific dates like 3,14,19,25 etc. Tried but not working.

regards
Jay
0
Mira
Telerik team
answered on 18 Nov 2011, 04:49 PM
Hello Jay,

You can the CSS class conditionally only to some dates:
void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
    if (e.Day.Date == new DateTime(2011, 11, 11))
    {
        e.Cell.CssClass = "redClass";
    }
}

I hope this helps.

Best wishes,
Mira
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
Calendar
Asked by
Jay
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jay
Top achievements
Rank 1
Mira
Telerik team
Share this question
or