I have a application written using the asp.net 1.1 framework.
When the user selects the date from the calendar using the 1.1 framework, the date is entered properly in the textbox. When I run the same code under version 2.o, the program does not enter the date into the text box. See code below:
TESTCALENDAR.ASPX
<html>
<head>
<script language="Javascript">
function GetDate(CtrlName)
{
/****************************************************
Use Javascript method (window.open) to PopUp a new window
which contain a Calendar Control. In the meantime, we'll
pass the Parent Form Name and Request Control Name in the QueryString!
*****************************************************/
ChildWindow = window.open('DatePicker.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
}
function CheckWindow()
{
ChildWindow.close();
}
</script>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
<asp:TextBox id="txtDateDue" runat="server" Width="90px"></asp:TextBox>
<a href="javascript:GetDate(txtDateDue')"><img id="imgDateDue" height="16" alt="PopUp Calendar" src="Images/SmallCalendar.gif" width="16" border="0" /></a>
</form>
</body>
</html>
DATEPICKER.ASPX
<html>
<head>
<script language="Javascript">
function ReturnDate()
{
window.opener.document.forms["<%= strFormName %>"].elements["<%= strCtrlName %>"].value = "<%= strSelectedDate %>";
window.close();
}
function Close()
{
window.close();
}
</script>
</head>
<body>
<form runat="server">
<table>
<tbody>
<tr>
<td align="middle">
Month:
<aspropDownList id="ddlMonth" runat="server" OnSelectedIndexChanged="ddl_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="1">January</asp:ListItem>
<asp:ListItem Value="2">February</asp:ListItem>
<asp:ListItem Value="3">March</asp:ListItem>
<asp:ListItem Value="4">April</asp:ListItem>
<asp:ListItem Value="5">May</asp:ListItem>
<asp:ListItem Value="6">June</asp:ListItem>
<asp:ListItem Value="7">July</asp:ListItem>
<asp:ListItem Value="8">August</asp:ListItem>
<asp:ListItem Value="9">September</asp:ListItem>
<asp:ListItem Value="10">October</asp:ListItem>
<asp:ListItem Value="11">November</asp:ListItem>
<asp:ListItem Value="12">December</asp:ListItem>
</aspropDownList>
Year:
<aspropDownList id="ddlYear" runat="server" OnSelectedIndexChanged="ddl_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="2004">2004</asp:ListItem>
<asp:ListItem Value="2005">2005</asp:ListItem>
<asp:ListItem Value="2006">2006</asp:ListItem>
<asp:ListItem Value="2007">2007</asp:ListItem>
<asp:ListItem Value="2008">2008</asp:ListItem>
<asp:ListItem Value="2009">2009</asp:ListItem>
<asp:ListItem Value="2010">2010</asp:ListItem>
<asp:ListItem Value="2011">2011</asp:ListItem>
<asp:ListItem Value="2012">2012</asp:ListItem>
<asp:ListItem Value="2013">2013</asp:ListItem>
<asp:ListItem Value="2014">2014</asp:ListItem>
</aspropDownList>
</td>
</tr>
<tr>
<td align="middle">
<asp:Calendar id="myCalendar" runat="server" BorderWidth="1px" BackColor="#FFFFCC" Width="220px" DayNameFormat="FirstLetter" ForeColor="#663399" Height="200px" Font-Size="8pt" Font-Names="Verdana" BorderColor="#FFCC66" ShowGridLines="True" OnSelectionChanged="myCalendar_SelectionChanged">
<SelectorStyle backcolor="#FFCC66"></SelectorStyle>
<NextPrevStyle font-size="9pt" forecolor="#FFFFCC"></NextPrevStyle>
<DayHeaderStyle height="1px" backcolor="#FFCC66"></DayHeaderStyle>
<SelectedDayStyle font-bold="True" backcolor="#CCCCFF"></SelectedDayStyle>
<TitleStyle font-size="9pt" font-bold="True" forecolor="#FFFFCC" backcolor="#990000"></TitleStyle>
<OtherMonthDayStyle forecolor="#CC9966"></OtherMonthDayStyle>
</asp:Calendar>
</td>
</tr>
<tr>
<td align="middle">
<input id="btnReturnDate" onclick="Javascript:ReturnDate()" type="button" value="Select" runat="Server" />
<input id="btnCloseWindow" onclick="Javascript:Close()" type="button" value="Close" runat="Server" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
When the user selects the date from the calendar using the 1.1 framework, the date is entered properly in the textbox. When I run the same code under version 2.o, the program does not enter the date into the text box. See code below:
TESTCALENDAR.ASPX
<html>
<head>
<script language="Javascript">
function GetDate(CtrlName)
{
/****************************************************
Use Javascript method (window.open) to PopUp a new window
which contain a Calendar Control. In the meantime, we'll
pass the Parent Form Name and Request Control Name in the QueryString!
*****************************************************/
ChildWindow = window.open('DatePicker.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
}
function CheckWindow()
{
ChildWindow.close();
}
</script>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
<asp:TextBox id="txtDateDue" runat="server" Width="90px"></asp:TextBox>
<a href="javascript:GetDate(txtDateDue')"><img id="imgDateDue" height="16" alt="PopUp Calendar" src="Images/SmallCalendar.gif" width="16" border="0" /></a>
</form>
</body>
</html>
DATEPICKER.ASPX
<html>
<head>
<script language="Javascript">
function ReturnDate()
{
window.opener.document.forms["<%= strFormName %>"].elements["<%= strCtrlName %>"].value = "<%= strSelectedDate %>";
window.close();
}
function Close()
{
window.close();
}
</script>
</head>
<body>
<form runat="server">
<table>
<tbody>
<tr>
<td align="middle">
Month:
<aspropDownList id="ddlMonth" runat="server" OnSelectedIndexChanged="ddl_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="1">January</asp:ListItem>
<asp:ListItem Value="2">February</asp:ListItem>
<asp:ListItem Value="3">March</asp:ListItem>
<asp:ListItem Value="4">April</asp:ListItem>
<asp:ListItem Value="5">May</asp:ListItem>
<asp:ListItem Value="6">June</asp:ListItem>
<asp:ListItem Value="7">July</asp:ListItem>
<asp:ListItem Value="8">August</asp:ListItem>
<asp:ListItem Value="9">September</asp:ListItem>
<asp:ListItem Value="10">October</asp:ListItem>
<asp:ListItem Value="11">November</asp:ListItem>
<asp:ListItem Value="12">December</asp:ListItem>
</aspropDownList>
Year:
<aspropDownList id="ddlYear" runat="server" OnSelectedIndexChanged="ddl_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="2004">2004</asp:ListItem>
<asp:ListItem Value="2005">2005</asp:ListItem>
<asp:ListItem Value="2006">2006</asp:ListItem>
<asp:ListItem Value="2007">2007</asp:ListItem>
<asp:ListItem Value="2008">2008</asp:ListItem>
<asp:ListItem Value="2009">2009</asp:ListItem>
<asp:ListItem Value="2010">2010</asp:ListItem>
<asp:ListItem Value="2011">2011</asp:ListItem>
<asp:ListItem Value="2012">2012</asp:ListItem>
<asp:ListItem Value="2013">2013</asp:ListItem>
<asp:ListItem Value="2014">2014</asp:ListItem>
</aspropDownList>
</td>
</tr>
<tr>
<td align="middle">
<asp:Calendar id="myCalendar" runat="server" BorderWidth="1px" BackColor="#FFFFCC" Width="220px" DayNameFormat="FirstLetter" ForeColor="#663399" Height="200px" Font-Size="8pt" Font-Names="Verdana" BorderColor="#FFCC66" ShowGridLines="True" OnSelectionChanged="myCalendar_SelectionChanged">
<SelectorStyle backcolor="#FFCC66"></SelectorStyle>
<NextPrevStyle font-size="9pt" forecolor="#FFFFCC"></NextPrevStyle>
<DayHeaderStyle height="1px" backcolor="#FFCC66"></DayHeaderStyle>
<SelectedDayStyle font-bold="True" backcolor="#CCCCFF"></SelectedDayStyle>
<TitleStyle font-size="9pt" font-bold="True" forecolor="#FFFFCC" backcolor="#990000"></TitleStyle>
<OtherMonthDayStyle forecolor="#CC9966"></OtherMonthDayStyle>
</asp:Calendar>
</td>
</tr>
<tr>
<td align="middle">
<input id="btnReturnDate" onclick="Javascript:ReturnDate()" type="button" value="Select" runat="Server" />
<input id="btnCloseWindow" onclick="Javascript:Close()" type="button" value="Close" runat="Server" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>