gtvingo14
asked on
PostBack of Parent from Child
I have variable sent to parent form from child, then child closes, after which I need to post back the parent form...whats the best way of doing this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In the child window
Whenever you want your parent form to be refreshed like clickking on a close link
use like this
<script type="text/javascript" language="javascript">
function refreshParent()
{
if (opener && !opener.closed) opener.location.reload(tru e);
self.close();
}
</script>
<a href="javascript:refreshPa rent();">C lose Me </a>
use like this
<script type="text/javascript" language="javascript">
function refreshParent()
{
if (opener && !opener.closed) opener.location.reload(tru
self.close();
}
</script>
<a href="javascript:refreshPa
ASKER
this asks for me if i want to refresh the main window....i dont want it to ask me, just do it....
also, when it does...the pop up comes back
also, when it does...the pop up comes back
Main form
<html>
<head>
<script language="JavaScript"><!--
var windowReference;
function openPopup() {
windowReference = window.open('popup.htm','w indowName' );
if (!windowReference.opener)
windowReference.opener = self;
}
//--></script>
</head>
<body>
<form name="formName" onSubmit="alert('submit triggered')">
</form>
</body>
</html>
Child form
<form>
<input type="button" value="Submit" onClick="opener.document.f ormName.su bmit();win dow.close( );">
</form>
<html>
<head>
<script language="JavaScript"><!--
var windowReference;
function openPopup() {
windowReference = window.open('popup.htm','w
if (!windowReference.opener)
windowReference.opener = self;
}
//--></script>
</head>
<body>
<form name="formName" onSubmit="alert('submit triggered')">
</form>
</body>
</html>
Child form
<form>
<input type="button" value="Submit" onClick="opener.document.f
</form>
ASKER
i cant get this to work either...
i have some vb code that is triggered by the button....Button html is below
<asp:button id="Button1" style="Z-INDEX: 131; LEFT: 392px; POSITION: absolute; TOP: 424px" runat="server" Height="24" Width="104px" Text="Deny Request" BackColor="LightCoral" BorderColor="LightCoral">< /asp:butto n>
i have some vb code that is triggered by the button....Button html is below
<asp:button id="Button1" style="Z-INDEX: 131; LEFT: 392px; POSITION: absolute; TOP: 424px" runat="server" Height="24" Width="104px" Text="Deny Request" BackColor="LightCoral" BorderColor="LightCoral"><
If you've already got the rest working, then in the body tag of the child:
<body onunload="opener.document. yourform.s ubmit();">
Change "yourform" to whatever you called your form in the parent.
<body onunload="opener.document.
Change "yourform" to whatever you called your form in the parent.
ASKER