Hello,
I am attempting to do something very simple. I have
a page MainPage.aspx and a popup window Popup.aspx. When
users click on the linkbutton in the popup window I am
looking to do some server side processing in Popup.aspx,
then have the popup window close, and have the
MainPage.aspx do a postback to the server. But I am
having trouble determining what client side javascript
Popup.aspx should render after it does its server side
processing. Are there any samples or articles tha
demonstrate how to do this? I keep getting "Object
Expected" in CloseChildWindow():
script.js
-------------------------------
var PopUp;
// Called from MainPage.aspx
function OpenPopup(id, mode, eid)
{
var url = "";
url += "Controls/PopUp.aspx?";
url += "FormName=" + document.forms[0].name;
url += "&id="+ id;
url += "&m=" + mode;
url += "&eid="+ eid;
var width = 250;
var height = 150;
var str = "";
str += "toolbars=no,";
str += "status=no,";
str += "resizable=0,";
str += "scrollbars=0,";
str += "width=" + width + ",";
str += "height=" + height + ",";
if ( window.screen ) {
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2;
var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc;
str += ",top=" + yc + ",screenY=" + yc;
}
PopUp = window.open( url, 'EmailList', str );
}
function CloseChildWindow(id, postBack)
{
debugger;
PopUp.close();
if (postBack)
__doPostBack(id,'');
}
The code I have in Popup.aspx is
<script language="JavaScript">
<!--
window.onload=window_onload();
function window_onload() {
window.opener.CloseChildWindow('a', true);
}
//-->
</script>
Any help would be appreciated! Thanks. 12 1892
Hi, besides from all the obvious things like domain rights, and case
sensitiv try to look for this:
For JavaScript to be public(seen by other programs) in IE, It has to be
declared in the html header.
If I interpret your JavaScript correctly, it looks like your script is
supposed to close the window AFTER a PostBack. The page in the browser after
a postback is not the same page that was in the browser BEFORE the PostBack.
It may be the same HTML document, but the memory of the new instance is not
the same as the memory of the old - HTTP is stateless. To the browser, it is
a whole new page. Therefore, there is no longer a window object reference in
memory pointing to the child window. Using the same variable name does
nothing.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message
news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some server side processing in Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
Hi
If I get you right...
Do the processing in the popup
Return a script to the popup that calls some method(s) in the opener
window.opener.document.forms[0].mySubmitBtn.click(); // This will click a
submit button named mySubmitBtn
Or call a function in parent window(opener)
window.opener.FUNCTIONNAME();
window.close();// Close child
--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
"Mark Fox" <in**@solelsoftware.com> wrote in message
news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some server side processing in Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
Mark,
I have some code for just this at my website, www.aboutfortunate.com. Just
search the code library for: "refresh main window" or something similar. The
title of the sample you want is:
Close a popup window and refresh the parent window
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Mark Fox" <in**@solelsoftware.com> wrote in message
news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some server side processing in Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
Justin,
I downloaded the code from your site (which is very
helpful stuff) but could not find the sample you referred
to (I actually didn't find any samples). I also didn't
find a search function on your site. Is the function
you're referring to in the Javascript namespace? Where
might I find the samples you mentioned? Thanks! -----Original Message----- Mark,
I have some code for just this at my website,
www.aboutfortunate.com. Justsearch the code library for: "refresh main window" or
something similar. Thetitle of the sample you want is:
Close a popup window and refresh the parent window
Sincerely,
-- S. Justin Gengo, MCP Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order." Nietzche
"Mark Fox" <in**@solelsoftware.com> wrote in message news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I
have a page MainPage.aspx and a popup window Popup.aspx.
When users click on the linkbutton in the popup window I am looking to do some server side processing in
Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
.
Justin,
I downloaded the code from your site (which is very
helpful stuff) but could not find the sample you referred
to (I actually didn't find any samples). I also didn't
find a search function on your site. Is the function
you're referring to in the Javascript namespace? Where
might I find the samples you mentioned? Thanks! -----Original Message----- Mark,
I have some code for just this at my website,
www.aboutfortunate.com. Justsearch the code library for: "refresh main window" or
something similar. Thetitle of the sample you want is:
Close a popup window and refresh the parent window
Sincerely,
-- S. Justin Gengo, MCP Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order." Nietzche
"Mark Fox" <in**@solelsoftware.com> wrote in message news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I
have a page MainPage.aspx and a popup window Popup.aspx.
When users click on the linkbutton in the popup window I am looking to do some server side processing in
Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
.
Hi Mark, Would the child window posting back to the server cause the parent-child reference variable to be lost?
When you use the JavaScript window.open() method, the window object that
refers to the child window is in the parent window's HTML document. If the
parent window posts back, the reference is lost, as the parent window's
document is unloaded. If the child window posts back, the document in the
child window changes, and all memory in that document is lost, but as the
reference to the child window is in the parent window's document, it isn't
lost.
The child window can close itself without any problems.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message
news:08****************************@phx.gbl... Kevin,
Thanks for the explanation. I am not sure whether this applies or not, but I am looking to close the child window after the child window posts back (not the parent). The intended order of events:
1) User presses linkbutton in child window 2) Child window posts pack to server 3) Child window closes 4) Parent window posts back to server
Would the child window posting back to the server cause the parent-child reference variable to be lost?
-----Original Message----- If I interpret your JavaScript correctly, it looks like your script issupposed to close the window AFTER a PostBack. The page in the browser aftera postback is not the same page that was in the browser BEFORE the PostBack.It may be the same HTML document, but the memory of the new instance is notthe same as the memory of the old - HTTP is stateless. To the browser, it isa whole new page. Therefore, there is no longer a window object reference inmemory pointing to the child window. Using the same variable name doesnothing.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some server side processing in Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
.
Hi Mark, Would the child window posting back to the server cause the parent-child reference variable to be lost?
When you use the JavaScript window.open() method, the window object that
refers to the child window is in the parent window's HTML document. If the
parent window posts back, the reference is lost, as the parent window's
document is unloaded. If the child window posts back, the document in the
child window changes, and all memory in that document is lost, but as the
reference to the child window is in the parent window's document, it isn't
lost.
The child window can close itself without any problems.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message
news:08****************************@phx.gbl... Kevin,
Thanks for the explanation. I am not sure whether this applies or not, but I am looking to close the child window after the child window posts back (not the parent). The intended order of events:
1) User presses linkbutton in child window 2) Child window posts pack to server 3) Child window closes 4) Parent window posts back to server
Would the child window posting back to the server cause the parent-child reference variable to be lost?
-----Original Message----- If I interpret your JavaScript correctly, it looks like your script issupposed to close the window AFTER a PostBack. The page in the browser aftera postback is not the same page that was in the browser BEFORE the PostBack.It may be the same HTML document, but the memory of the new instance is notthe same as the memory of the old - HTTP is stateless. To the browser, it isa whole new page. Therefore, there is no longer a window object reference inmemory pointing to the child window. Using the same variable name doesnothing.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some server side processing in Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
.
Mark,
The Javascript button you clicked on is not the actual code library. That
was a link to the javascript project I've built which contains javascripts I
use over and over. All the other javascripts and other code I haven't made
into classes is in the datagrid on the main code library page.
When you click the "code library" link on the site in the main area of the
page is a datagrid. Above the datagrid is a search text box and button. Do
your search there. Or page through the datagrid.
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Mark Fox" <in**@solelsoftware.com> wrote in message
news:03****************************@phx.gbl... Justin,
I downloaded the code from your site (which is very helpful stuff) but could not find the sample you referred to (I actually didn't find any samples). I also didn't find a search function on your site. Is the function you're referring to in the Javascript namespace? Where might I find the samples you mentioned? Thanks!
-----Original Message----- Mark,
I have some code for just this at my website, www.aboutfortunate.com. Justsearch the code library for: "refresh main window" or something similar. Thetitle of the sample you want is:
Close a popup window and refresh the parent window
Sincerely,
-- S. Justin Gengo, MCP Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order." Nietzche
"Mark Fox" <in**@solelsoftware.com> wrote in message news:07****************************@phx.gbl... Hello,
I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some server side processing in Popup.aspx, then have the popup window close, and have the MainPage.aspx do a postback to the server. But I am having trouble determining what client side javascript Popup.aspx should render after it does its server side processing. Are there any samples or articles tha demonstrate how to do this? I keep getting "Object Expected" in CloseChildWindow():
script.js ------------------------------- var PopUp;
// Called from MainPage.aspx function OpenPopup(id, mode, eid) { var url = ""; url += "Controls/PopUp.aspx?"; url += "FormName=" + document.forms[0].name; url += "&id="+ id; url += "&m=" + mode; url += "&eid="+ eid;
var width = 250; var height = 150;
var str = ""; str += "toolbars=no,"; str += "status=no,"; str += "resizable=0,"; str += "scrollbars=0,"; str += "width=" + width + ","; str += "height=" + height + ",";
if ( window.screen ) { var ah = screen.availHeight - 30; var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2; var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc; str += ",top=" + yc + ",screenY=" + yc; }
PopUp = window.open( url, 'EmailList', str ); }
function CloseChildWindow(id, postBack) { debugger; PopUp.close(); if (postBack) __doPostBack(id,''); }
The code I have in Popup.aspx is
<script language="JavaScript"> <!--
window.onload=window_onload();
function window_onload() { window.opener.CloseChildWindow('a', true); }
//--> </script>
Any help would be appreciated! Thanks.
.
Kevin,
Thank you for your clear explanation! Based on
that, I was able to get it working with the child window
closing itself. Thanks a million. -----Original Message----- Hi Mark,
Would the child window posting back to the server cause the parent-child reference variable to be lost? When you use the JavaScript window.open() method, the
window object thatrefers to the child window is in the parent window's
HTML document. If theparent window posts back, the reference is lost, as the
parent window'sdocument is unloaded. If the child window posts back,
the document in thechild window changes, and all memory in that document is
lost, but as thereference to the child window is in the parent window's
document, it isn'tlost.
The child window can close itself without any problems.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message news:08****************************@phx.gbl... Kevin,
Thanks for the explanation. I am not sure whether this applies or not, but I am looking to close the
child window after the child window posts back (not the parent). The intended order of events:
1) User presses linkbutton in child window 2) Child window posts pack to server 3) Child window closes 4) Parent window posts back to server
Would the child window posting back to the server cause the parent-child reference variable to be lost?
>-----Original Message----- >If I interpret your JavaScript correctly, it looks
like your script is >supposed to close the window AFTER a PostBack. The
page in the browser after >a postback is not the same page that was in the
browser BEFORE the PostBack. >It may be the same HTML document, but the memory of
the new instance is not >the same as the memory of the old - HTTP is stateless. To the browser, it is >a whole new page. Therefore, there is no longer a
window object reference in >memory pointing to the child window. Using the same variable name does >nothing. > >-- >HTH, > >Kevin Spencer >Microsoft MVP >..Net Developer >http://www.takempis.com >Neither a follower nor a lender be. > > >"Mark Fox" <in**@solelsoftware.com> wrote in message >news:07****************************@phx.gbl... >> Hello, >> >> I am attempting to do something very simple. I have >> a page MainPage.aspx and a popup window Popup.aspx. When >> users click on the linkbutton in the popup window I
am >> looking to do some server side processing in Popup.aspx, >> then have the popup window close, and have the >> MainPage.aspx do a postback to the server. But I am >> having trouble determining what client side
javascript >> Popup.aspx should render after it does its server
side >> processing. Are there any samples or articles tha >> demonstrate how to do this? I keep getting "Object >> Expected" in CloseChildWindow(): >> >> script.js >> ------------------------------- >> var PopUp; >> >> // Called from MainPage.aspx >> function OpenPopup(id, mode, eid) >> { >> var url = ""; >> url += "Controls/PopUp.aspx?"; >> url += "FormName=" + document.forms[0].name; >> url += "&id="+ id; >> url += "&m=" + mode; >> url += "&eid="+ eid; >> >> var width = 250; >> var height = 150; >> >> var str = ""; >> str += "toolbars=no,"; >> str += "status=no,"; >> str += "resizable=0,"; >> str += "scrollbars=0,"; >> str += "width=" + width + ","; >> str += "height=" + height + ","; >> >> if ( window.screen ) { >> var ah = screen.availHeight - 30; >> var aw = screen.availWidth - 10; >> >> var xc = ( aw - width ) / 2; >> var yc = ( ah - height ) / 2; >> >> str += ",left=" + xc + ",screenX=" + xc; >> str += ",top=" + yc + ",screenY=" + yc; >> } >> >> PopUp = window.open( url, 'EmailList', str ); >> } >> >> function CloseChildWindow(id, postBack) >> { >> debugger; >> PopUp.close(); >> if (postBack) >> __doPostBack(id,''); >> } >> >> The code I have in Popup.aspx is >> >> <script language="JavaScript"> >> <!-- >> >> window.onload=window_onload(); >> >> function window_onload() { >> window.opener.CloseChildWindow('a', true); >> } >> >> //--> >> </script> >> >> Any help would be appreciated! Thanks. > > >. >
.
Justin,
Thank you for the explanation. I found it! -----Original Message----- Mark,
The Javascript button you clicked on is not the actual
code library. Thatwas a link to the javascript project I've built which
contains javascripts Iuse over and over. All the other javascripts and other
code I haven't madeinto classes is in the datagrid on the main code library
page. When you click the "code library" link on the site in
the main area of thepage is a datagrid. Above the datagrid is a search text
box and button. Doyour search there. Or page through the datagrid.
Sincerely,
-- S. Justin Gengo, MCP Web Developer
Free code library at: www.aboutfortunate.com
"Out of chaos comes order." Nietzche
"Mark Fox" <in**@solelsoftware.com> wrote in message news:03****************************@phx.gbl... Justin,
I downloaded the code from your site (which is
very helpful stuff) but could not find the sample you
referred to (I actually didn't find any samples). I also didn't find a search function on your site. Is the function you're referring to in the Javascript namespace? Where might I find the samples you mentioned? Thanks!
>-----Original Message----- >Mark, > >I have some code for just this at my website, www.aboutfortunate.com. Just >search the code library for: "refresh main window" or something similar. The >title of the sample you want is: > >Close a popup window and refresh the parent window > >Sincerely, > >-- >S. Justin Gengo, MCP >Web Developer > >Free code library at: >www.aboutfortunate.com > >"Out of chaos comes order." > Nietzche > > >"Mark Fox" <in**@solelsoftware.com> wrote in message >news:07****************************@phx.gbl... >> Hello, >> >> I am attempting to do something very simple. I have >> a page MainPage.aspx and a popup window Popup.aspx. When >> users click on the linkbutton in the popup window I
am >> looking to do some server side processing in Popup.aspx, >> then have the popup window close, and have the >> MainPage.aspx do a postback to the server. But I am >> having trouble determining what client side
javascript >> Popup.aspx should render after it does its server
side >> processing. Are there any samples or articles tha >> demonstrate how to do this? I keep getting "Object >> Expected" in CloseChildWindow(): >> >> script.js >> ------------------------------- >> var PopUp; >> >> // Called from MainPage.aspx >> function OpenPopup(id, mode, eid) >> { >> var url = ""; >> url += "Controls/PopUp.aspx?"; >> url += "FormName=" + document.forms[0].name; >> url += "&id="+ id; >> url += "&m=" + mode; >> url += "&eid="+ eid; >> >> var width = 250; >> var height = 150; >> >> var str = ""; >> str += "toolbars=no,"; >> str += "status=no,"; >> str += "resizable=0,"; >> str += "scrollbars=0,"; >> str += "width=" + width + ","; >> str += "height=" + height + ","; >> >> if ( window.screen ) { >> var ah = screen.availHeight - 30; >> var aw = screen.availWidth - 10; >> >> var xc = ( aw - width ) / 2; >> var yc = ( ah - height ) / 2; >> >> str += ",left=" + xc + ",screenX=" + xc; >> str += ",top=" + yc + ",screenY=" + yc; >> } >> >> PopUp = window.open( url, 'EmailList', str ); >> } >> >> function CloseChildWindow(id, postBack) >> { >> debugger; >> PopUp.close(); >> if (postBack) >> __doPostBack(id,''); >> } >> >> The code I have in Popup.aspx is >> >> <script language="JavaScript"> >> <!-- >> >> window.onload=window_onload(); >> >> function window_onload() { >> window.opener.CloseChildWindow('a', true); >> } >> >> //--> >> </script> >> >> Any help would be appreciated! Thanks. > > >. >
.
You're very kind. :)
--
You're welcome,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message
news:09****************************@phx.gbl... Kevin,
Thank you for your clear explanation! Based on that, I was able to get it working with the child window closing itself. Thanks a million.
-----Original Message----- Hi Mark,
Would the child window posting back to the server cause the parent-child reference variable to be lost?
When you use the JavaScript window.open() method, the window object thatrefers to the child window is in the parent window's HTML document. If theparent window posts back, the reference is lost, as the parent window'sdocument is unloaded. If the child window posts back, the document in thechild window changes, and all memory in that document is lost, but as thereference to the child window is in the parent window's document, it isn'tlost.
The child window can close itself without any problems.
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com Neither a follower nor a lender be.
"Mark Fox" <in**@solelsoftware.com> wrote in message news:08****************************@phx.gbl... Kevin,
Thanks for the explanation. I am not sure whether this applies or not, but I am looking to close the child window after the child window posts back (not the parent). The intended order of events:
1) User presses linkbutton in child window 2) Child window posts pack to server 3) Child window closes 4) Parent window posts back to server
Would the child window posting back to the server cause the parent-child reference variable to be lost?
>-----Original Message----- >If I interpret your JavaScript correctly, it looks like your script is >supposed to close the window AFTER a PostBack. The page in the browser after >a postback is not the same page that was in the browser BEFORE the PostBack. >It may be the same HTML document, but the memory of the new instance is not >the same as the memory of the old - HTTP is stateless. To the browser, it is >a whole new page. Therefore, there is no longer a window object reference in >memory pointing to the child window. Using the same variable name does >nothing. > >-- >HTH, > >Kevin Spencer >Microsoft MVP >..Net Developer >http://www.takempis.com >Neither a follower nor a lender be. > > >"Mark Fox" <in**@solelsoftware.com> wrote in message >news:07****************************@phx.gbl... >> Hello, >> >> I am attempting to do something very simple. I have >> a page MainPage.aspx and a popup window Popup.aspx. When >> users click on the linkbutton in the popup window I am >> looking to do some server side processing in Popup.aspx, >> then have the popup window close, and have the >> MainPage.aspx do a postback to the server. But I am >> having trouble determining what client side javascript >> Popup.aspx should render after it does its server side >> processing. Are there any samples or articles tha >> demonstrate how to do this? I keep getting "Object >> Expected" in CloseChildWindow(): >> >> script.js >> ------------------------------- >> var PopUp; >> >> // Called from MainPage.aspx >> function OpenPopup(id, mode, eid) >> { >> var url = ""; >> url += "Controls/PopUp.aspx?"; >> url += "FormName=" + document.forms[0].name; >> url += "&id="+ id; >> url += "&m=" + mode; >> url += "&eid="+ eid; >> >> var width = 250; >> var height = 150; >> >> var str = ""; >> str += "toolbars=no,"; >> str += "status=no,"; >> str += "resizable=0,"; >> str += "scrollbars=0,"; >> str += "width=" + width + ","; >> str += "height=" + height + ","; >> >> if ( window.screen ) { >> var ah = screen.availHeight - 30; >> var aw = screen.availWidth - 10; >> >> var xc = ( aw - width ) / 2; >> var yc = ( ah - height ) / 2; >> >> str += ",left=" + xc + ",screenX=" + xc; >> str += ",top=" + yc + ",screenY=" + yc; >> } >> >> PopUp = window.open( url, 'EmailList', str ); >> } >> >> function CloseChildWindow(id, postBack) >> { >> debugger; >> PopUp.close(); >> if (postBack) >> __doPostBack(id,''); >> } >> >> The code I have in Popup.aspx is >> >> <script language="JavaScript"> >> <!-- >> >> window.onload=window_onload(); >> >> function window_onload() { >> window.opener.CloseChildWindow('a', true); >> } >> >> //--> >> </script> >> >> Any help would be appreciated! Thanks. > > >. >
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: bbxrider |
last post by:
i'm new to javascript but have programmed lots in vb, cobol, basic, etc
jscript seems much more object oriented to me, much more direct manipulation
of properties at least, than vb, don't know...
|
by: bj |
last post by:
I have several pages that I want to allow the same kind of activity,
so my basic question is how best to structure the interaction (and I
have one related subquestion as well).
Scenario: The...
|
by: Eli |
last post by:
Hi gurus,
My question is about exchanging data on a basic HTML page between a
JavaScript piece of code and a Java client-side <APPLET> residing on
the same webpage.
To demonstrate the idea of...
|
by: blueapricot416 |
last post by:
This is a very basic question -- but I can't find the answer after
looking for 20 minutes.
If you code something like:
function set_It() {
setTimeout('Request_Complete("apple", -72)',5000)
}...
|
by: John Bailo |
last post by:
http://www.informationweek.com/software/showArticle.jhtml?articleID=196600515
Developers Embrace Java, Drop Visual Basic
"Developers have abandoned Microsoft's Visual Basic in droves during...
|
by: craig.burrell |
last post by:
I'm not a Javascript programmer, and I have a basic question about how
scripts may make use of libraries in Javascript. I thank everyone for
humouring me.
Do all of the libraries required by a...
|
by: Bill H |
last post by:
25 years ago every computer came with some form of Basic interpreter
so you could use yoru computer without having to buy more software. Is
Javascript (teamed with HTML) set to become the new...
|
by: MikeB |
last post by:
Hello All, I am new to ajax and wanted to start by trying something simple.
I have a web form with an updatepanel and then inside the update panel I
have a listbox. Then outside of the updatepanel...
|
by: sheldonlg |
last post by:
This is kind of basic, and I googled but didn't find much help.
I have an array of text element fields. They all need to have the same
name. So, let the name be either all with a or build...
|
by: rmurgia |
last post by:
When a variable is created using Javascript, should it then be able to be read immediately using embedded VB code or does the submit command have to be entered or are the variables between...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |