Link to home
Start Free TrialLog in
Avatar of gtvingo14
gtvingo14Flag for Afghanistan

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
Avatar of ramesh12
ramesh12

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gtvingo14

ASKER

where do you put this code at?
Avatar of ramesh12
ramesh12

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(true);
self.close();
}
</script>

<a href="javascript:refreshParent();">Close Me </a>
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
Main form


<html>

<head>
<script language="JavaScript"><!--
var windowReference;

function openPopup() {
  windowReference = window.open('popup.htm','windowName');
  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.formName.submit();window.close();">
</form>
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:button>
If you've already got the rest working, then in the body tag of the child:

<body onunload="opener.document.yourform.submit();">

Change "yourform" to whatever you called your form in the parent.