View Full Version : iframe content refresh question

10-24-2006, 04:44 PM
Hello all,

I have a main.apsx page which host two other Iframes (a.aspx and b.aspx).

In the main page I have radio buttons and a configuration drop down list that are used to determined which storeprocedure a.aspx page will call next and post back the info via datalist control. Also in the main.aspx page I have another drop down list with the interval time values for a.aspx and b.aspx pages to be refreshed.

b.aspx page will be launched as an (content) extension of a.aspx.

1)How do I refresh a.apsx and b.aspx pages with selected interval value from the main.aspx page?
2)Would all of the passing values (radio buttons, configuration drop down values) from the main page to a.aspx page be lost when the refreshing occurs? IF yes, how do i avoid this ?


10-24-2006, 05:42 PM
If I'm understanding you correctly, you want a page with two iframes, one of which should refresh periodically, taking data from a form on the top page. I've no idea what "an (content) extension" is, so I'm going to ignore it for now.

I think the way you're approaching this is fundamentally wrong. It may be that I'm just failing to grasp your design, but it seems to me that it would be a much better idea to only refresh the iframe when the form changes. For example:
<form action="a.aspx" target="iframe_a" name="gallery_form">
<select onchange="this.form.submit();">
<option value="1">Gallery One</option>
<option value="2">Gallery Two</option>
<option value="3">Gallery Three</option>
<input type="submit" value="Go" name="submit_button">

<script type="text/javascript">
// Hide the submit button for Javascript-capable browsers.
document.forms['gallery_form'].elements['submit_button'].style.display = "none";

<iframe name="iframe_a">
Alternative content not required, since frame-incapable browsers
will simply display the results of the submission in the main window.
</iframe>However, it would be a saner idea, in my opinion, to use a single static page without the iframes, and links for the galleries. This would provide the maximum accessibility, and keep vital browser functions (like "back" and "bookmark") working the way they should, as well as conforming to Strict DOCTYPEs.

10-24-2006, 06:19 PM

This is not about my photography page in flash. This is a different page I am trying to build with asp.net. I have a need to refresh the a.aspx page at a certain interval (5, 10 secs) selectable by users. The content rendered by a.aspx page depends on the inputs (radios, dropdown) from the main.aspx page. Another word, main.aspx will call up a.aspx with passing variables (passed by main.aspx)

b.aspx will show addtional information about what in the content rendered by a.aspx (i.e., artist personal information that are not included in the a.aspx page). That's what I meant by extension.

The information rendered in a.aspx page constantly updated in the backend and I need to refresh that page at a certain time interval, selectable by a dropdown list from the main.aspx page.

Ofcourse, the page (a.aspx) should be refresh if there is another form to be submitted with new set of values.
The question remain
a) How would you suggest a solution from this type of content refresh w/o losing all that values passed.

10-24-2006, 06:23 PM
This is not about my photography page in flash.I didn't realise you were the same person :p

I see what you mean now, but the question of why the page needs to refresh at this interval still remains. Is the content going to change based on something other than the selections made by the user?

10-24-2006, 06:25 PM
and the content of the iframes that host a.aspx and the b.aspx are the ONLY two needed to be refreshed at the same time not the whole page.

10-24-2006, 06:30 PM
Dont forget the content of the a.aspx page is dynamically rendered with the data in the backend. And this data is constantly updated and needed to be reflected on the page within the time frame selected from the drop down list (of the main page)

10-24-2006, 06:47 PM
<script type="text/javascript">
function updateFrames() {
var e = document.forms['form_name'];
e.action = "b.aspx";
e.target = "iframe_b";
e.action = "a.aspx";
e.target = "iframe_a";
setTimeout(updateFrames, (parseInt(e.elements['update_interval'].value) || 5) * 1000);

window.onload = updateFrames;

<form name="form_name" action="a.aspx" target="iframe_a">
<select name="update_interval" style="display: none;">
<option value="1">One second</option>
<option value="5">Five seconds</option>
<option value="10">Ten seconds</option>
<input type="submit" value="Update" name="submit_button">

<script type="text/javascript">
var e;

// Hide the submit button for Javascript-capable browsers...
(e = document.forms['form_name'].elements)['submit_button'].style.display = "none";
// ... and show the select.
e['update_interval'].style.display = "";
</script>However, this is a really ugly way to do things, and I'm pretty sure there's probably a better one.

10-24-2006, 08:36 PM
This is what confused me. From the main page I have 2 radios, 1 drop down (for some selective options) and a button (on top of the refresh drop down). This button will launch the a.aspx for the inframe_a already with all the values passed from those inputs. IF I do what you mentioned above, I would launch that a.aspx page again (refresh) w/o all the passed values . Therefore the a.aspx page appears to be refreshed (from the main page) but it would not have the same structure as before (w all the values passed from the 2 radios and dropdownlist).

Maybe I just did not explain clear enough. Say, depends on what the values passed to a.aspx page are S_type= "1" and Conf="2" will call '"toreprocedure1" (says..it bring back 3 pieces of data x,y,z that are constantly changed from the db) and render to a.aspx page.

Now , if the I do the refresh as mentioned above, a.apsx page would not pass the same S_type="1" and Conf="2" values ..therefore "store_procedure" will not be called from a.aspx. Instead, a.aspx would end up and call a default store_procedure and render the data (says 5 pieces of data). So eventhough the data (of the default store_procedure) is refreshed..but this is a different set of information (structural) that far different from the first one.

10-24-2006, 08:39 PM
Ah, but it does. Note this:
var e = document.forms['form_name'];
e.action = "b.aspx";
e.action = "a.aspx";If you put that data inside the form "form_name," it will be passed to both the a.aspx and the b.aspx pages.

10-24-2006, 09:05 PM
Thanks Twey.