Solved

Iframe close on submit data and refresh parent

Posted on 2008-06-10
7
1,702 Views
Last Modified: 2012-06-22
I have an Iframe which contains a form. After the user clicks on the submits button, the data should go to the database [i have done this] and the iframe should close automatically and refresh the parent page.

Is there any way I can do this on server side?

The problem wiht the following code is that the user has to double click in order for the form to close. Also, the parent page doesnt refresh.
Protected Sub submit_btn_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles submit_btn.Click
               //database queries.
 
                submit_btn.Attributes.Add("OnClick", "javascript:closeiframe();return false;")
    End Sub

Open in new window

0
Comment
Question by:digitalZo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 31

Accepted Solution

by:
James Murrell earned 500 total points
ID: 21757546
unsure but have you looked into

window.opener.location.reload()
0
 
LVL 31

Expert Comment

by:James Murrell
ID: 21757550
also found this it may help


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
<html>
<head>
<title>Untitled</title>
</head>
 
<body onUnload="javascript:load('a.html',top.opener)">
 
<form>
<script language="JavaScript"><!--
function load(file,target) {
if (target != '')
target.window.location.href = file;
else
window.location.href = file;
}
//--></script>
 
Test
</form>
 
 
</body>
</html> 

Open in new window

0
 
LVL 10

Author Comment

by:digitalZo
ID: 21757620
where do i put this: window.opener.location.reload()?

also, i tried body unload...it didnt work..the parent page didnt refresh. secondly, i have to click on submit button twice to make the form close. how do i close it on first click?
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 31

Expert Comment

by:James Murrell
ID: 21757646
can you post your code here?
0
 
LVL 10

Author Comment

by:digitalZo
ID: 21757708
ok i added this in form tag and it worked:
  <form id="form1" runat="server" onsubmit="parent.location.reload();">

the only problem it's showing is that if the form is not yet filled then the page reloads with the new data in the dropdown without any hitches....but if there's data on the parent page, then on refresh, either the data stays intact but the new data does not get inserted in the dropdown OR the data disappears.

any idea why this is happening? and solution?

thanks for all your help. appreciated. :)
0
 
LVL 10

Author Closing Comment

by:digitalZo
ID: 31466042
Your solution did not help me, but I'd still give you points for attempting to answer.
0
 
LVL 31

Expert Comment

by:James Murrell
ID: 21758177
Thanks, very supporative comment... you could have asked for question to be deleted, but once again Thanks,
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question