prasadalone
Programmer
- Aug 15, 2002
- 87
I am calling cander.aspx page through javascript
i am using window.opener to set the values of the textbox
i think because my textbox is server control so that through calendar.aspx page i am not able to pass the values to the texbox is there any way to transfer the values from calendar.aspx page to the textbox on the calling page
<tr>
<td valign="top" width="30%">
Payment received Date</td>
<td valign="top" width="70%">
<asp:TextBox id="paymrecddate" runat="server" name="paymrecddate"></asp:TextBox>
<a href="javascript:calendar_window=window.open('/calendar.aspx?formname=frmCalendar.txtDate','calendar_window','width=154,height=188');calendar_window.focus()">Calendar </a></td>
</tr>
Following is the code for calendar.aspx page
<%@ Page Language="vb" %>
<script runat="server">
Private Sub Calendar1_SelectionChanged(sender As Object, e As System.EventArgs)
Dim strjscript as string = "<script language=""javascript"">"
strjscript = strjscript & "window.opener." & Httpcontext.Current.Request.Querystring("formname") & ".value = '" & Calendar1.SelectedDate & "';window.close();"
strjscript = strjscript & "</script" & ">" 'Don't Ask, Tool Bug
Literal1.text = strjscript
window.opener.document.forms[0].TextBox1.value
End Sub
Private Sub Calendar1_DayRender(sender As Object, e As System.Web.UI.WebControls.DayRenderEventArgs)
If e.Day.Date = datetime.now().tostring("d") Then
e.Cell.BackColor = System.Drawing.Color.LightGray
End If
End Sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Choose a Date</title>
</head>
<body leftmargin="0" topmargin="0">
<form runat="server">
<asp:Calendar id="Calendar1" runat="server" Width="120" Height="60" ForeColor="#00000" BorderColor="#000000" FirstDayOfWeek="Monday" BackColor="#ffffff" SelectionMode="Day" DayNameFormat="FirstTwoLetters" showtitle="true" OnDayRender="Calendar1_dayrender" OnSelectionChanged="Calendar1_SelectionChanged">
<TitleStyle backcolor="#000080" forecolor="#ffffff" />
<NextPrevStyle backcolor="#000080" forecolor="#ffffff" />
<OtherMonthDayStyle forecolor="#c0c0c0" />
</asp:Calendar>
<asp:Literal id="Literal1" runat="server"></asp:Literal>
</form>
</body>
</html>