Calendar Control info

M

Manoj Paramu Das

Hi,

found this code by Sushila B. Patel, which shows the events for the current
month, but shows nothing if its from another month since it has e.Cell.Text
= "" if .Day.IsOtherMonth =true any idea to implement that part?

Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
'If the month is CurrentMonth
If Not e.Day.IsOtherMonth Then
Dim dr As DataRow
For Each dr In dsCalendar.Tables(0).Rows
'If UserDate is not Null
If Not dr("UserDate") Is DBNull.Value Then
Dim dtEvent As DateTime = dr("UserDate").ToString
'If UserDate =CalendarDate
If dtEvent.Equals(e.Day.Date) Then
e.Cell.BackColor = Color.PaleVioletRed
End If
End If
Next
'If the month is not CurrentMonth then hide the Dates
Else
e.Cell.Text = ""
End If
End Sub

Thanks in Advance
 
M

Mona

Hi Manoj,

Remove the condition where he's checking for .IsOtherMonth
and and make sure that the dataset holds event information
for the previous month and the next month so that the events can be filled in.

HTH

Mona
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top