Calendar control click event

  • Thread starter Thread starter Vishal Gupta
  • Start date Start date
V

Vishal Gupta

Hello:

I have a calendar control that defaults to today as the selected date.
Problem is, if the user clicks on the selected date then since there is no
change in date the SelectedChanged does not fire. There is no other control
event that fires either. How do I acknowledge the user selection of a
pre-selected date?

Thanks.
 
One workaround is to force a call to the SelectionChanged handler if the
date hasn't changed.

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Calendar1.SelectedDate = Viewstate("SelDate") Then
Call Calendar1_SelectionChanged(Calendar1, e)
End If
End Sub


Private Sub Calendar1_SelectionChanged _
(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Calendar1.SelectionChanged
Viewstate("SelDate") = Calendar1.SelectedDate
Label1.Text = Calendar1.SelectedDate.ToLongDateString & _
" selected at: " & Now.ToLongTimeString
End Sub
 
Back
Top