Solved

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

Posted on 2008-10-05
3
261 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

861 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now