PopUp Calendar Problem



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">
<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/
<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"></
<SelectorStyle ForeColor="#336666" BackColor="#99CCCC"></
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF"></
<DayHeaderStyle Height="1px" ForeColor="#336666"
<SelectedDayStyle Font-Bold="True" ForeColor="#CCFF99"
<TitleStyle Font-Size="10pt" Font-Bold="True" Height="25px"
BorderWidth="1px" ForeColor="#CCCCFF"
BorderStyle="Solid" BorderColor="#3366CC" BackColor="#003399"></
<WeekendDayStyle BackColor="#CCCCFF"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#999999"></OtherMonthDayStyle>
<input type="hidden" id="control" runat="server"

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>"
"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=, 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">
<td align="center" style="height: 19px; width: 61px;">
<td align="Left" style="height: 19px; width: 103px;">
&nbsp;<table style="width: 286px; height: 57px">
<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">
<td style="width: 25px; height: 21px">
<A onclick="window.open('popup.aspx?
href="javascript:;"><IMG src="Images/calendar.png" border="0"></A>
<td style="height: 21px">
<asp:textbox id="txtStartDate" runat="server"
width="106px" Height="12px"></asp:textbox></td>
<td style="height: 21px">
<td style="width: 25px">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;


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