G
Guest
Hi,
I have been trying for days, yes days, to use the calender from the asp.net
timetracker starter kit. I am now frustrated. I finally get the popup
calender to popup but when I click ok to insert the date to the calling page
I get the error
"A runtime error has occured
Line 14
Error: 'popUp is null or not an object'
This is the code for the page that is calling the popup. (on page load)
btnDateFrom.Attributes("onclick") =
"javascript:OpenCalendar('txtFrom',true)"
This is in the <HEAD> section of that page
<script language="javascript" src="script.js" type="text/javascript"></script>
This is the script.js
var popUp; <-----------------------note popUp here
function OpenCalendar(idname, postBack)
{
popUp = window.open('Calender.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=270,height=260,left=200,top=250');
}
function SetDate(formName, id, newDate, postBack)
{
eval('var theform = document.' + formName + ';');
popUp.close();
theform.elements[id].value = newDate;
if (postBack)
__doPostBack(id,'');
}
This is the code for the OK button on the calender page on page load
Dim selected As String = Request.QueryString("selected")
Dim id As String = Request.QueryString("id")
Dim form As String = Request.QueryString("formname")
Dim postBack As String = Request.QueryString("postBack")
btnOk.Attributes.Add("onClick", "window.opener.SetDate('" + form + "','" +
id + "', document.Calender.datechosen.value," + postBack + ");")
Help please! The Calender popups up fine all I need now is to pass the
select data back to the main form.
Thanks
I have been trying for days, yes days, to use the calender from the asp.net
timetracker starter kit. I am now frustrated. I finally get the popup
calender to popup but when I click ok to insert the date to the calling page
I get the error
"A runtime error has occured
Line 14
Error: 'popUp is null or not an object'
This is the code for the page that is calling the popup. (on page load)
btnDateFrom.Attributes("onclick") =
"javascript:OpenCalendar('txtFrom',true)"
This is in the <HEAD> section of that page
<script language="javascript" src="script.js" type="text/javascript"></script>
This is the script.js
var popUp; <-----------------------note popUp here
function OpenCalendar(idname, postBack)
{
popUp = window.open('Calender.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=270,height=260,left=200,top=250');
}
function SetDate(formName, id, newDate, postBack)
{
eval('var theform = document.' + formName + ';');
popUp.close();
theform.elements[id].value = newDate;
if (postBack)
__doPostBack(id,'');
}
This is the code for the OK button on the calender page on page load
Dim selected As String = Request.QueryString("selected")
Dim id As String = Request.QueryString("id")
Dim form As String = Request.QueryString("formname")
Dim postBack As String = Request.QueryString("postBack")
btnOk.Attributes.Add("onClick", "window.opener.SetDate('" + form + "','" +
id + "', document.Calender.datechosen.value," + postBack + ");")
Help please! The Calender popups up fine all I need now is to pass the
select data back to the main form.
Thanks