I want to be able to style certain dates in my calendar control. In my application I can attach notes to dates (e.g. 15.09.2011 -> John’s birthday).
Dates which have one or more notes attached to them should be styled differently. How can I achieve this?
If you are using the standard ASP.NET calendar control, then you can style dates by implementing a DayRender(…) event handler. The DayRender event is raised for each day that is created for the Calendar control.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar.dayrender.aspx
Here you can check which date you are handling and style it. In your case, this is where you check if there is a note attached to the date. If so, you give it a different style.
Here’s an example that demonstrates this approach:
http://www.c-sharpcorner.com/UploadFile/puranindia/CalendarcontrolASPNET09162009030359AM/CalendarcontrolASPNET.aspx
The example marks all the Indian holidays.
Some quick code: