Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP and Iframes? 1

Status
Not open for further replies.

lynque

IS-IT--Management
Sep 30, 2004
124
0
0
CA
Hello all,

I have an Iframe(content) with a page loaded in it, I'd like to load content with another page that has an Iframe(datagrid) in it and populate the Iframe(datagrid) with another page.

I'm not sure if this is the correct forum for this question but all of the pages loaded in the Iframes are asp...

I'm familiar with framesets but not Iframes

Any help is appreciated
 
ASP.NET is the forum you are looking for....here is the link

forum855

-L
 
I heavily use IFRAMEs like they were subform/subreports in Access...

I currently use them on IIS5 with ASP.

Here are some suggestions on how I have used IFRAMEs in the past:

Syntax:
Code:
<iframe allowtransparency="true" name="SomeIFRAMEName" src="<%=strListURL%>" border=0 frameborder=0 width=100% scrolling=auto height=100%> 
  Some kind of text for users with such old browsers they can't see IFRAMES...
</iframe>
The attributes I use the most are:
[ul][li]Name: I use this so I can refer to the IFRAME in Javascript.[/li]
[li]scrolling: this rocks... you can have a tiny iframe in the middle of the screen with its own scroll bar, as opposed to the traditional frameset that restricts you to full quadrants of the page.[/li]
[li]I haven't really toyed with the width and height attributes of the IFRAME much, but I do put the IFRAME tags inside tables or divs... fun to use in DIVs with some JS to make them draggable... [/li]
[li]src=<%=someASPVariable%> this is useful... so that you can control what content goes into the IFRAME with scripting.[/li][/ul]

The two ways I control the content of the IFRAME are either at page load, with the last point mentioned above, or with javascript:
Code:
document.SomeIFRAMEname.location = "anotherpage.asp";

In a sense, treat your IFRAME as if it was a DIV... and you can place it inside any block of HTML code (Tables, paragraphs, etc...)

HEre are some links that might help:

And you can see an example of it here:

This object is defined in HTML 4.0 and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1.
-from MSDN's page on IFRAME

happy coding!

Earnie Eng
 
Thanks Earnie,

I may have mislead you with my first question...
I have an iframe on main.asp named "content" which is always visible, I would like to replace the page in content (checkout.asp)with another page(search.asp) that has an Iframe in it named "datagrid".
I know with framesets and js, parent.document.location.href is the way to load specific pages in other frames but datagrid won't exist until search.asp has loaded so "datagrid is null or not an object" yet.
How do I pass from checkout.asp to search.asp that I would like search.asp to load reviewOrder.asp in datagrid?

If you haven't gone cross eyed yet feel free...
 
so... what I understand is:

you have an IFRAME called [blue]content[/blue],

within search.asp, you have an IFRAME called datagrid...

you want to load search.asp into [blue]content[/blue] as well as something else into [blue]datagrid[/blue]

if that's the case, you can, using javascript or html <a> tag with the target set to [blue]content[/blue]:

in JS,
Code:
document.content.location='search.asp?datagridURL=<%=var%>';

then... in your search.asp, you simply can Request.Querystring that value passed and use ASP/VBScript to set the source of the datagrid IFRAME

(and yes.. you can embed ASP inside of the client-side Javascript)

in HTML
Code:
<a href="search.asp?datagridURL=<%=var%>" target="content">link text here</a>

and likewise, use the passed querystring variable to tell search.asp what to load into datagrid.

did I get it right?


Earnie Eng
 
Going home try again tomorrow
 
Thanks Earnie, once again you have helped
 
I'm glad you got things working!

Thanks for the star.

Earnie Eng
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top