PopUp Calendar Problem

S

Sharon

Hello Everyone,

I have made a webform in asp.net 2005 with a calendar control, please
see below for code. I have another webpage with hyperlink to
popupcalendar page. The problem is the second page has a masterpage
and when i click the hyperlink the popupcalendar is displayed but the
date selected is not being transferred to the text box in the second
page, It works fine if i remove the master page link from the second
page, any ideas guys whats happening here.

HTML CODE - Popup Calendar:

<%@ Page Language="vb" AutoEventWireup="false"
Inherits="KMAttendance.PopUp" CodeFile="PopUp.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>PopUp</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/
intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Calendar ID="calDate" OnSelectionChanged="Change_Date"
Runat="server" BorderWidth="1px" BackColor="White"
Width="220px" DayNameFormat="FirstLetter" ForeColor="#003399"
Height="200px" Font-Size="8pt"
Font-Names="Verdana" BorderColor="#3366CC" CellPadding="1">
<TodayDayStyle ForeColor="White" BackColor="#99CCCC"></
TodayDayStyle>
<SelectorStyle ForeColor="#336666" BackColor="#99CCCC"></
SelectorStyle>
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF"></
NextPrevStyle>
<DayHeaderStyle Height="1px" ForeColor="#336666"
BackColor="#99CCCC"></DayHeaderStyle>
<SelectedDayStyle Font-Bold="True" ForeColor="#CCFF99"
BackColor="#009999"></SelectedDayStyle>
<TitleStyle Font-Size="10pt" Font-Bold="True" Height="25px"
BorderWidth="1px" ForeColor="#CCCCFF"
BorderStyle="Solid" BorderColor="#3366CC" BackColor="#003399"></
TitleStyle>
<WeekendDayStyle BackColor="#CCCCFF"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#999999"></OtherMonthDayStyle>
</asp:Calendar>
<input type="hidden" id="control" runat="server"
visible="false">&nbsp;
</form>
</body>
</HTML>

VB CODE-popup calendar:

Imports System.Web.UI.HtmlControls.HtmlGenericControl

Namespace KMAttendance
Partial Class PopUp
Inherits System.Web.UI.Page


Private Sub Page_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
'control.Value = Request("textbox")
control.Value = Request.QueryString("textbox")
End Sub

Protected Sub Change_Date(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Dim strScript As String =
"<script>window.opener.document.forms(0)." +
Request.QueryString("textbox").ToString() + ".value = '"
'strScript += calDate.SelectedDate.ToString("dd/MM/yyyy")
strScript += calDate.SelectedDate.ToLongDateString
strScript += "';self.close()"
strScript += "</" + "script>"
RegisterClientScriptBlock("Calendar_ChangeDate",
strScript)
'Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
"anything", strScript, True)
End Sub

Private Sub InitializeComponent()

End Sub

End Class

End Namespace

HTML Code-Second Webpage
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="NoUpdate.aspx.vb"
Inherits="KMAttendance.NoUpdate" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms,
Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>


<asp:Content ID="Content1"
ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table border="0" align="Left" cellpadding="0" cellspacing="4"
bordercolordark="silver" style="width: 456px; height: 16px">
<tr>
<td align="center" style="height: 19px; width: 61px;">
</td>
<td align="Left" style="height: 19px; width: 103px;">
&nbsp;<table style="width: 286px; height: 57px">
<tr>
<td style="width: 25px; height: 21px;">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/
error.png" Width="20px" Height="19px" /></td>
<td style="height: 21px">
<asp:Label ID="Label1" runat="server" Font-Bold="True"
Text="Access Denied" Width="167px"></asp:Label></td>
<td style="height: 21px">
&nbsp;</td>
</tr>
<tr>
<td style="width: 25px; height: 21px">
<A onclick="window.open('popup.aspx?
textbox=txtStartDate','cal','width=250,height=225,left=270,top=180')"
href="javascript:;"><IMG src="Images/calendar.png" border="0"></A>
</td>
<td style="height: 21px">
<asp:textbox id="txtStartDate" runat="server"
width="106px" Height="12px"></asp:textbox></td>
<td style="height: 21px">
</td>
</tr>
<tr>
<td style="width: 25px">
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
</asp:Content>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top