Monday, June 23, 2008

asp:Calendar Title Border Issue

The asp:Calendar is a powerful and flexible control, but it has some quirks that take some getting used to. The problem that I had recently, was changing the color of the black border around the title and next/previous month indicators.

If you use your own custom formatting, it will still cause an issue with the border, but it is easier to fix. The main issue is that the control automatically inserts a style tag on the td of the header table of { border:solid; }. What you have to do is set the color of the border to the same color as your title background.

The issue can be fixed by wrapping the calendar in a div and specifying the border in your css file with div.calendar table td { border-color:white; } (where .calendar is the name of the class on your div wrapping the calendar and :white is the color of your background).