Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Loading a page in another frame


Message #1 by "Balasubramaniam R" <bala.rangaraj@d...> on Fri, 6 Sep 2002 07:23:49
I have three frame structure. On the top frame, I have a IE Web Control 
toolbar. There are 5 buttons. On click of the toolbar(in the top frame), I 
should open 5 different pages on the botton frame depending on which 
toolbar button is clicked. I could open the page only in the frame in 
which he has clicked. How do I say the target frame to open the page?
Message #2 by "Salvador Gallego" <salvito@h...> on Fri, 6 Sep 2002 12:55:37
I'm not sure but, are you just talking about Html code?

If you do, you have to do is:

<a href="YourPage.yourExtension" target="FrameName">Description</a>

You can see the frame name on the index page you are using, I mean, the 
one who distribute the frames.

If you are using an asp.net object (like toolbar maybe could be..) 
probably the best way would be to writte a response.write ("the code I 
told you") order on the On_Click event of the toolbar button.

Hope it to be useful,

Regards,

From Spain:
Salvador Gallego.

> I have three frame structure. On the top frame, I have a IE Web Control 
t> oolbar. There are 5 buttons. On click of the toolbar(in the top frame), 
I 
s> hould open 5 different pages on the botton frame depending on which 
t> oolbar button is clicked. I could open the page only in the frame in 
w> hich he has clicked. How do I say the target frame to open the page?
Message #3 by "Aaron Chavez" <achavez382@w...> on Wed, 11 Sep 2002 19:34:56
I have the same question, trying the same thing.

> I'm not sure but, are you just talking about Html code?
> If you do, you have to do is:
> <a href="YourPage.yourExtension" target="FrameName">Description</a>

> If you are using an asp.net object (like toolbar maybe could be..) 
p> robably the best way would be to writte a response.write ("the code I 
t> old you") order on the On_Click event of the toolbar button.

This will display a page with the link in the current frame.  

The problem, if it's the same as mine, is in the call to Redirect() and 
designating a frame.  I'm assuming there's a way to do this with 
javascript, but I haven't found it.

acha vez382*worldsavings!com
Message #4 by "Aaron Chavez" <achavez382@w...> on Wed, 11 Sep 2002 22:36:57
>> The problem, if it's the same as mine, is in the call to Redirect() and 
designating a frame.  I'm assuming there's a way to do this with 
javascript, but I haven't found it.
<<

To answer my own question:
Server-side frame script knows nothing of frames.  I dug up two scripts 
that provide for frame redirection, both from German sites, fwiw...


ASP/VBS

This is what will redirect a frame

  <script language="JavaScript">
    parent.frmRight.location.replace('http://www.aspheute.com/');
  </script> '...// hier folgt left.htm per #include ...

and THIS is what gets it there

  <script language="vbscript" runat="server">
  Sub TargetedRedirect(ByVal strTarget, ByVal strTargetFrame, ByVal   
bDontTouchHistory)
    Response.Write "<scr" & "ipt language=""JavaScript"">" & vbCrLf
    Response.Write "parent." & strTargetFrame & ".location."
    If True = bDontTouchHistory Then
        Response.Write "replace(" & "'" & strTarget & "');"
    Else
        Response.Write "href='" & strTarget & "';"
    End If
    Response.Write vbCrlf & "</scr" & "ipt>" & vbCrlf
  End Sub
  </script>


There was also this c#/javascript for .NET

ASP.NET
  <script runat="server">

  void Link_Click(object sender, EventArgs e)
  {
   FrameRedirect("right2.aspx", "right"); 
  }

  void FrameRedirect(string url, string target)
  {
   string script = "<script language=\"JavaScript\">";
   script += 
    "parent.frames[\"" + target + "\"].location.href=\"";
   script += url + "\";</";
   script += "script>";

   if(!IsStartupScriptRegistered("redirect"))
     this.RegisterStartupScript("redirect", script);
  }

  </script>

  <form runat="server">

  <ASP:LinkButton runat="server"
   Text="Rechten Frame wechseln"
   OnClick="Link_Click"/>

  </form>

  Return to Index