RadCalendar - Forecolor

8 posts, 0 answers
  1. Jay
    Jay avatar
    10 posts
    Member since:
    Sep 2008

    Posted 09 Nov 2011 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Nov 2011 Link to this post

    Hello Jay,

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

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jay
    Jay avatar
    10 posts
    Member since:
    Sep 2008

    Posted 10 Nov 2011 Link to this post

    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

  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 14 Nov 2011 Link to this post

    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
  6. Jay
    Jay avatar
    10 posts
    Member since:
    Sep 2008

    Posted 14 Nov 2011 Link to this post

    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
  7. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 16 Nov 2011 Link to this post

    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
  8. Jay
    Jay avatar
    10 posts
    Member since:
    Sep 2008

    Posted 16 Nov 2011 Link to this post

    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
  9. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 18 Nov 2011 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017