Results 1 to 10 of 10

Thread: iframe content refresh question

  1. #1
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question iframe content refresh question

    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.

    Question:
    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 ?

    Thanks
    Tony

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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:
    Code:
    <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>
      </select>
      <input type="submit" value="Go" name="submit_button">
    </form>
    
    <script type="text/javascript">
      // Hide the submit button for Javascript-capable browsers.
      document.forms['gallery_form'].elements['submit_button'].style.display = "none";
    </script>
    
    <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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Twey,

    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.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This is not about my photography page in flash.
    I didn't realise you were the same person

    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?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  6. #6
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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)

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    OK...:
    Code:
    <script type="text/javascript">
    function updateFrames() {
      var e = document.forms['form_name'];
      e.submit();
      e.action = "b.aspx";
      e.target = "iframe_b";
      e.submit();
      e.action = "a.aspx";
      e.target = "iframe_a";
      setTimeout(updateFrames, (parseInt(e.elements['update_interval'].value) || 5) * 1000);
    }
    
    window.onload = updateFrames;
    </script>
    
    <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>
      </select>
      <input type="submit" value="Update" name="submit_button">
    </form>
    
    <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.
    Last edited by Twey; 10-24-2006 at 08:41 PM. Reason: Modify target appropriately.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah, but it does. Note this:
    Code:
      var e = document.forms['form_name'];
      e.submit();
      e.action = "b.aspx";
      e.submit();
      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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Twey.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •