Hi,
because postback events (where changes happened in control state are
detected) are raised after Page_Load, the state of the Calendar has not yet
been updated in Page_Load. You get the SelectedDate for sure by having a
handler for Calendar's SelectionChanged event. In this event handler you'll
get the correct date from the SelectedDate property.
Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Calendar1.SelectionChanged
lblSelectedDate.Text = Calendar1.SelectedDate
End Sub
(My example is written with VS.NET so it uses code-behind. You might want to
declare the event handler in aspx if you use inline mode.
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://www.drumpub.com/caltest.aspx
Check the test page at the above link. Could someone please tell me why I'm
capturing the calendar's SelectedDate "one post behind"? The source code is
on the page too.
Thanks!
Shane