Link to home
Start Free TrialLog in
Avatar of bbimis
bbimis

asked on

calendar control - i assume a tooltip but not sure how to do it.

i would like to add a calendar to my website that when I hover over a date it reads the data from my sql server for that date.

For example I have managers on call different days of the weeks. if I hover over the date I want it to show who is on call.

a working example would be wonderful...  Thanks!
Avatar of bbimis
bbimis

ASKER

I thought something along these lines but can't get it to work:
Imports System.Data.SqlClient

Partial Class main
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

        Dim ConnectionString As String = System.Web.Configuration.WebConfigurationManager.ConnectionStrings("dbconn").ToString()
        Dim Id As String = "1"

        Dim MyConn As New System.Data.SqlClient.SqlConnection(ConnectionString)
        Dim MyComm As New System.Data.SqlClient.SqlCommand("SELECT * FROM [dbo].[Table] WHERE id = " + Id, MyConn)

        MyConn.Open()
        Dim DataReader As System.Data.SqlClient.SqlDataReader = MyComm.ExecuteReader()

        While (DataReader.Read())




        End While

        DataReader.Close()
        MyConn.Close()


    End Sub


    Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs)
        Dim ConnectionString As String = System.Web.Configuration.WebConfigurationManager.ConnectionStrings("dbconn").ToString()



        Dim MyConn As New System.Data.SqlClient.SqlConnection(ConnectionString)
        Dim MyComm As New System.Data.SqlClient.SqlCommand("SELECT * FROM [dbo].[docs] WHERE date = " + Calendar1.SelectedDate, MyConn)

        MyConn.Open()
        Dim DataReader As System.Data.SqlClient.SqlDataReader = MyComm.ExecuteReader()

        While (DataReader.Read())
            Calendar1.ToolTip = "the date is" + Calendar1.SelectedDate

            

        End While

        DataReader.Close()
        MyConn.Close()






    End Sub

End Class

Open in new window

then in the aspx take and call the following:
<asp:Calendar ID="Calendar1" runat="server" OnDayRender="Calendar1_DayRender"  ></asp:Calendar>
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bbimis

ASKER

thanks that worked.