This might be a hack but it seems to work... call SelectionChanged
yourself....
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
If IsPostBack Then
If viewstate("stopcalendarchange") _
<> True Then
Call Calendar1_SelectionChanged _
(Calendar1, Nothing)
End If
End If
End Sub
Private Sub Calendar1_SelectionChanged _
(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Calendar1.SelectionChanged
Label1.Text = _
Calendar1.SelectedDate.ToLongDateString & _
" at " & Now.ToLongTimeString
End Sub
Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
viewstate("stopcalendarchange") = True
Label1.Text = "Stopped getting same date."
' Calendar1.Enabled = False
' Calendar1.Visible = False
End Sub
<form id="Form1" method="post" runat="server">
<asp:Calendar id="Calendar1" runat="server"></asp:Calendar>
<P>
<asp:Label id="Label1" runat="server"></asp:Label></P>
<P>
<asp:Button id="Button1" runat="server" Text="Stop getting same
date"></asp:Button></P>
</form>
Ken
Microsoft MVP [ASP.NET]
"mg" <mg@theworld.com> wrote in message
news:4C**********************************@microsof t.com...
When I click any date in System.Web.UI.WebControls.Calendar (C# WebForm),
the SelectionChanged event handler fires. If I next click on the same date
again, this event handler does not fire, so I can't get the selected date
directly from the calendar on two successive attempts.
How can I get this same selected date from the calendar on two successive
attempts. Storing the value obtained on the first attempt isn't helpful.