• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

Calendar Day Render

Good Afternoon Experts,

I am trying to create a calendar functionality which display summary of data pulled off from SQL Database on each date.

What I want to achieve now is that when the user have mouse over any of the date it shows the detailed description of the day events.

Any suggestions would be much appreciated!!

0
radhakrishan
Asked:
radhakrishan
  • 3
  • 2
1 Solution
 
pradeepsudharsanCommented:
Hai,
Plz try the following code.
First add the calendar control.Add the code in the server side.
Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
        Dim lbl As New Label
        lbl.Text = "My Birth day"
        Dim bdate As DateTime
        bdate = New Date(2006, 6, 3)

        If (e.Day.Date.Day = bdate.Day) And (e.Day.Date.Month = bdate.Month) Then
            e.Cell.Controls.Add(lbl)
        End If

    End Sub

Regards
pradeep
0
 
pradeepsudharsanCommented:
Hi,
For exact result use the following code
 Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
        Dim a As String
        a = "My Birth day"
        Dim bdate As DateTime
        bdate = New Date(2006, 6, 3)

        If (e.Day.Date.Day = bdate.Day) And (e.Day.Date.Month = bdate.Month) Then
           
            e.Cell.ToolTip = a
        End If

    End Sub
Regards
Pradeep
0
 
radhakrishanAuthor Commented:
Hi,

Thanks very much for your help.


I am very near to achieve what i want, but I also struct with one thing.


     For Each xlrow As DataRow In datarow3
            Dim l1 As New Label
            l1.Text = "<BR>" + xlrow.Item(0) + " - All Day"
            e.Cell.Controls.Add(l1)
            e.Cell.BackColor = Color.Aqua
            mlabel.Text = mlabel.Text + "<BR>" + xlrow.Item(0) + " " + xlrow.Item(4) + "-" + xlrow.Item(5)
        Next

When this label text is being created the "<BR>" is actually taken as string rather then taken as a line carriage and I want that each record
should be on a separate line. How can I achieve that?

Cheers


0
 
radhakrishanAuthor Commented:
Hi,

I achieved the different line thing, but whats happening strange is that the space between my first item and next item is really large...

So it see somthing like on mouseover:

Room A                          11:45-12:45
Room B                          12:45-13:45

Can you pls help to how i can get round this problem?

--Cheers
0
 
pradeepsudharsanCommented:
Hi,
plz try this.

Use vbCrLf instead of <BR>
  Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
        Dim a As String
        a = "My" + vbCrLf + "Birth day"
        Dim bdate As DateTime
        bdate = New Date(2006, 6, 5)

        If (e.Day.Date.Day = bdate.Day) And (e.Day.Date.Month = bdate.Month) Then
            e.Cell.ToolTip = a
        End If

    End Sub

Regards
Pradeep
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now