ASP.net Calendar Control Not Posting Back

Capodecina
Permabanned
Joined
31 Dec 2003
Posts
5,172
Location
Barrow-In-Furness
I'm using a Calendar control to allow the user to select a date, based on their selection a set of results is fetched. Every time they select a new date it will cause a GridView to DataBind and get the new results.

For some reason though, if I try select todays date it does not postback and cause the Calendar1_SelectionChanged event to fire, it just does nothing.

It works for every other day except todays date. Todays date is automatically highlighted (not selected), but I can't figure out the problem.

There are two bits of code which relate to the Calendar..

Code:
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Calendar1.SelectedDate = Date.Today
    End Sub

    Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
        LoggedHoursGridView.DataBind()
    End Sub

Anyone got any ideas?
 
Nevermind guys i've solved this one..

Code:
  If Calendar1.SelectedDate = "12:00:00 AM" Then
            inDate = Date.Today
            Year = Date.Today.Year
        Else
            inDate = Calendar1.SelectedDate
            Year = Calendar1.SelectedDate.Year
        End If
 
Back
Top Bottom