G
Guest
i am using visual studio 2005 and I am trying to create a popup calender so
when a user click on a image on the main form, a calender will then popup,
the user will select a date and the date will then be passed back to the main
form and populate a textbox. it works fine. but when i used master page for
all my pages and i put the textbox inside the content , the calender pops up
but when i select the date nothing happens .. the textbox was not populated
with the selected date from the calender and the window was not closed.
here's code which popups the calendar:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentColumn"
Runat="server">
<div>
<A
onclick="window.open('Calendar.aspx?textbox=txtDate','cal','width=300,height=300,left=470,top=300')"
href="javascript:;"><asp:textbox id=txtDate runat="server"
ForeColor="Black" Width="88px"></asp:textbox>
<IMG src="images/SmallCalendar.gif" border="0"></A></div>
</asp:Content>
and here's the code for the calendar selection change:
Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Calendar1.SelectionChanged
Dim strjscript As String = "<script language=""javascript"">"
strjscript &= "window.opener." & _
HttpContext.Current.Request.QueryString("formname") & ".value
= '" & _
Calendar1.SelectedDate & "';window.close();"
strjscript = strjscript & "</scr" & "ipt>"
Literal1.Text = strjscript
End Sub
when a user click on a image on the main form, a calender will then popup,
the user will select a date and the date will then be passed back to the main
form and populate a textbox. it works fine. but when i used master page for
all my pages and i put the textbox inside the content , the calender pops up
but when i select the date nothing happens .. the textbox was not populated
with the selected date from the calender and the window was not closed.
here's code which popups the calendar:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentColumn"
Runat="server">
<div>
<A
onclick="window.open('Calendar.aspx?textbox=txtDate','cal','width=300,height=300,left=470,top=300')"
href="javascript:;"><asp:textbox id=txtDate runat="server"
ForeColor="Black" Width="88px"></asp:textbox>
<IMG src="images/SmallCalendar.gif" border="0"></A></div>
</asp:Content>
and here's the code for the calendar selection change:
Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Calendar1.SelectionChanged
Dim strjscript As String = "<script language=""javascript"">"
strjscript &= "window.opener." & _
HttpContext.Current.Request.QueryString("formname") & ".value
= '" & _
Calendar1.SelectedDate & "';window.close();"
strjscript = strjscript & "</scr" & "ipt>"
Literal1.Text = strjscript
End Sub