Calendar Control Question

  • Thread starter Thread starter Manoj Paramu Das
  • Start date Start date
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
 
Back
Top