On a site Im working on I have all pages in a Master Page, of course to help with theming and such. In one of the pages I have made a simple popup calendar. The problem Im having is I keep getting the error
QUOTE
'window.opener.document.forms.form1.StartDate' is null or not an object
Here's the code I use to open the popup calendar
jscript
<a href="java script:void(0);return false;" onclick="window.open('../../Popups/PopCalendar.aspx?type=StartDate','cal','width=250,height=225')">
Here's the code in the PopCalendar.aspx
csharp
protected void Change_Date(object sender, System.EventArgs e)
{
string script = "<script language=\"javas" + "cript\">\r\n";
script += "{\r\n";
script += "if(window.opener && !window.opener.closed)\r\n";
script += "{\r\n";
script += "window.opener.document.forms[\'form1\']." + control.Value + ".value = '" + calcDate.SelectedDate.ToString("MM/dd/yyyy") + "';\r\n";
script += "self.close();\r\n";
script += "}\r\n";
script += "}\r\n";
script += "</" + "script>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "SetDate", script);
}
I tried this
experiment in VB.NET and it worked fine (not in a Master Page mind you) and in C# without a Master Page it works just fine. Anyone got any ideas?