have the following code on a page:
the problem arises when I first open the window by pressing the btnPreview. The script gets called, I generate a url dynamically, adding a query string to it. The windown opens successfully the first time, however, if I close the popped up window and press that button again, it gives me the error described in the subject.
Anybody have any ideas why I might be running into this problem?
Thanks.
Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "DoPreview",
"<script language=javascript>\r\n" +
"<!-- \r\n" +
"function DoPreview()\r\n" +
"{\r\n" +
"debugger;\r\n" +
"var win=null;\r\n" +
"var em = 'email=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsEmail').value;\r\n" +
"var fn = '&fname=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsFirstName').value;\r\n" +
"var ln = '&lname=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsLastName').value\r\n;" +
"var pn = '&phone=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsPhone').value;\r\n" +
"var a1 = '&addr1=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsAddress').value;\r\n" +
"var a2 = '&addr2=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsAddress2').value;\r\n" +
"var ct = '&city=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsCity').value;\r\n" +
"var st = '&state=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsState').value;\r\n" +
"var zp = '&zip=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsZipCode').value;\r\n" +
"var cy = '&cntry=' + document.getElementById('ctl00_PlaceHolderMain_txtFriendsCountry').value;\r\n" +
"var pm = '&pmsg=' + document.getElementById('ctl00_PlaceHolderMain_txtPersonalMessage').value;\r\n" +
"var url = 'DoPreview.aspx?' + em + fn + ln + pn + a1 + a2 + ct + st + zp + cy + pm;\r\n" +
"win = window.open(url, null, 'height=700, width=800,status= no, resizable= yes, scrollbars=yes,toolbar=no,location=no,menubar=no');\r\n" +
"win.focus();\r\n" +
"}\r\n" +
" -->\r\n" +
"</script>\r\n", false);
btnPreview.Attributes.Add("OnClick", "DoPreview()");
}
}
the problem arises when I first open the window by pressing the btnPreview. The script gets called, I generate a url dynamically, adding a query string to it. The windown opens successfully the first time, however, if I close the popped up window and press that button again, it gives me the error described in the subject.
Anybody have any ideas why I might be running into this problem?
Thanks.
Comment