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

How to get a border around each day in calendar?

4 Answers 448 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Sugar
Top achievements
Rank 1
Sugar asked on 07 Dec 2009, 01:20 PM
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?

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Dec 2009, 02:06 PM
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
0
Daniel
Telerik team
answered on 07 Dec 2009, 02:18 PM
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.
0
Jerry
Top achievements
Rank 1
answered on 30 Apr 2012, 04:06 PM
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
0
Daniel
Telerik team
answered on 03 May 2012, 12:58 PM
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.
Tags
Calendar
Asked by
Sugar
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Daniel
Telerik team
Jerry
Top achievements
Rank 1
Share this question
or