redirecting within frameset

Discussion in 'ASP .Net' started by Serge L, Dec 15, 2003.

  1. Serge L

    Serge L Guest

    Ok, I have Main.htm page which contains:
    <frameset rows="20%,80%">
    <frame scrolling="no" name="top" src="ONE.aspx">
    <frame scrolling="yes" name="bottom" src="MAIN.aspx">
    </frameset>
    and I have another webform TWO.aspx

    So the top frame (one.aspx) contains action buttons and
    bottom frame is for display purposes.

    So when user clicks button on ONE.aspx I use:
    Server.Transfer("TWO.aspx")

    I would like TWO.aspx to replace MAIN.aspx on the bottom,
    but instead TWO.aspx replaces ONE.aspx on top.

    Is there any elegant way to do this?

    Thank you.
     
    Serge L, Dec 15, 2003
    #1
    1. Advertisements

  2. This is one of the many reasons that using frames in .NET is generally a bad
    idea.
    Usually you're better off partitioning logical sections of your page into
    web user controls.
    Here's more info:
    http://msdn.microsoft.com/library/d...n/html/vbconintroductiontowebusercontrols.asp
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vboriwebusercontrols.asp
    http://msdn.microsoft.com/library/d...l/vbconWebUserControlsVsCustomWebControls.asp

    If you must stick with frames then you'll need to use client side javascript
    to accomplish your goal.
     
    Steve C. Orr [MVP, MCSD], Dec 15, 2003
    #2
    1. Advertisements

  3. Hi Serge,

    I agree with Steve C., however there are a lot of times when frames are the
    best solution. In anycase, a server.transfer won't work.

    You can use a regular link:
    <a href="two.aspx" target="bottom"> ...

    Or some javascript:
    parent.bottom.location='two.aspx';

    If you want to register the javascript in your codebehind, then check out
    RegisterStartupScript function.

    -- Alex Papadimoulis
     
    Alex Papadimoulis, Dec 15, 2003
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.