Solved

How to annotate multiple days on an asp.net calendar control.

Posted on 2008-10-05
3
264 Views
Last Modified: 2010-05-18
I am trying to use a calendar control in an asp.net project. I have a situation where during the course of a month,  there may be several events that are happening, and I would like to make the days when those events are occuring to show in a different color on the calendar control.

How is this done?
0
Comment
Question by:dzumwalt
3 Comments
 
LVL 16

Accepted Solution

by:
GreymanMSC earned 250 total points
ID: 22647947
You need to implement the calendar's DayRender event, accessing the Cell container from the EventArgs and comparing it to your list of dates.

Something like this:
Protected Sub Calendar1_DayRender( _
    ByVal sender As Object, _
    ByVal e As System.Web.UI.WebControls.DayRenderEventArgs _
) Handles Calendar1.DayRender
 
    For Each dItem As Date in m_Dates
       If e.Day.Date.Equals(dItem) Then
          e.Cell.BackColor=Drawing.Color.Cyan
          Exit For
       End If
    End If
 
End Sub

Open in new window

0
 
LVL 6

Expert Comment

by:avnish_tanna
ID: 22648036
0
 

Author Closing Comment

by:dzumwalt
ID: 31503304
Perfect! Thats exactly what I neeed. Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question