How do you want this to work?
1. select a date on a page and redirect to another page?
-OR-
2. have a pop up window display a calendar and refresh data on the parent window?
1. on the SelectedDateChanged event do response.redirect("nextpage.aspx?d=" & myCalendar.SelectedDate.ToShortDateString). Then on nextpage.aspx in the page load event
Dim D as Date = cDate(Request.QueryString("d"))
2. on the main form place a link to open the popup window
<a href="javascript:window.open('calendar.aspx')"></a>. google javascript: window.open to find addtional options when opening a new window. also put a hidden text box on the form <input type=hidden id=txtHide runat=server />
on the SelectedDateChanged event put the following code
VB Code:
If calDate.SelectedDates.Count = 1 Then
Dim script As New System.Text.StringBuilder
script.Append("<script language='javascript'>")
script.Append("window.opener.document.forms[0].txtHide.value='" & calDate.SelectedDate.ToShortDateString & "';")
script.Append("window.opener.document.forms[0].submit();")
script.Append("window.close();")
script.Append("</script>")
Page.RegisterStartupScript("SetDate", script.ToString)
End If
then on your page load event of the parent form:
VB Code:
if not page.ispostback then
'first time page loads
else
if txtHide.Value <> "" Then
Try
Dim D as Date = cDate(txtHide.Value)
Catch
'value not a date
End Try
'query database for records to display
end if
end if