How to get a border around each day in calendar?

5 posts, 0 answers
  1. Sugar
    Sugar avatar
    10 posts
    Member since:
    Jan 2009

    Posted 07 Dec 2009 Link to this post

    Sounds simple, but, I'm trying to avoid the double border. Meaning, I can easily set the WeekendDayStyle.BorderWidth = 1, BorderColor=Black and BorderStyle = Solid, but, what happens is that all the days in the middle of the calendar control now have double borders because it's putting a border on the cell next to it also.

    Is there a way to get a single border around each cell? So, in effect, it would need to know if a cell next to it already has a border?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Dec 2009 Link to this post

    Hi Sugar,

    Try the following code snippet and see whether it helps.

    CS:
     
        protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) 
        { 
            e.Cell.BorderColor = System.Drawing.Color.Black; 
            e.Cell.BorderStyle = BorderStyle.Solid; 
            e.Cell.BorderWidth = 1; 
        } 

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 07 Dec 2009 Link to this post

    Hello,

    Try the following CSS snippet:
    <style type="text/css">
        .RadCalendar_Default .rcMain .rcMainTable
        {
            border-collapse:collapse;
        }               
        .RadCalendar_Default .rcMain .rcMainTable th
        {
            border-bottom-color:#000;
        }
        .RadCalendar_Default .rcMain .rcMainTable th.rcViewSel
        {
            border-bottom-color:#c5c5c5;
        }       
        .RadCalendar_Default .rcMain .rcMainTable .rcRow td
        {
            border-style: solid;
            border-color: #000;
        }
    </style>

    Please have in mind that you should replace Default with your skin name.

    Regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Jerry
    Jerry avatar
    44 posts
    Member since:
    Mar 2012

    Posted 30 Apr 2012 Link to this post

    Daniel,

    I used your code within my css and it makes the days and weekend borders display better but at the top and bottom of the calendar it has an extra line or it gets much darker when I switch months.  I attached what it looks like with the double lines under the days of the week.

    Thank you
  6. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 03 May 2012 Link to this post

    Hi Jerry,

    Post your RadCalendar declaration here, please.

    Thanks,
    Daniel
    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