Calendar Control Question

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
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top