|
Subject:
|
Using IFrames
|
|
Posted By:
|
gobotsoup
|
Post Date:
|
3/6/2007 7:24:54 PM
|
I have been having a lot of trouble getting IFrames to work. Can someone show me how to use IFrame to embed a remote web page into the current aspx page?
|
|
Reply By:
|
Hanch
|
Reply Date:
|
3/7/2007 7:37:58 AM
|
Just put the code like this somewhere in your body: <iframe id="Iframe1" src="http://www.wrox.com" style="width:300px;height:300px;"></iframe>
or send more specific info about the problems
|
|
Reply By:
|
gobotsoup
|
Reply Date:
|
3/7/2007 10:46:46 AM
|
oh yeah sorry I should have been more specific, I need to be able to change the page which is displayed programatically. Is there any way of accomplishing that? Effectively changing the src according to user input?
|
|
Reply By:
|
click
|
Reply Date:
|
3/7/2007 6:51:56 PM
|
You do this: <iframe id="Iframe1" src="<% getUrl() %>" style="width:300px;height:300px;"></iframe> and then in your code behind dim url as string sub someClicky() url = textbox1.text end sub
public function getUrl() return url end function
|
|
Reply By:
|
gobotsoup
|
Reply Date:
|
3/8/2007 7:14:05 PM
|
I have been trying that in C# and it doesnt seem to be working. code behind: protected string getUrl() { return Session["theUrl"].ToString(); } protected void Button1_Click(object sender, EventArgs e) { Session["theUrl"] = "http://reuters.com"; }
ASPX: <iframe id="Iframe1" src="<% getUrl(); %>" style="width:729px;height:594px;"></iframe>
|
|
Reply By:
|
click
|
Reply Date:
|
3/9/2007 10:42:54 AM
|
I will try it and paste the code. Just a minute.
|
|
Reply By:
|
click
|
Reply Date:
|
3/9/2007 11:02:13 AM
|
quote: Originally posted by gobotsoup
I have been trying that in C# and it doesnt seem to be working. code behind: protected string getUrl() { return Session["theUrl"].ToString(); } protected void Button1_Click(object sender, EventArgs e) { Session["theUrl"] = "http://reuters.com"; }
ASPX: <iframe id="Iframe1" src="<% =getUrl(); %>" style="width:729px;height:594px;"></iframe>
Sorry I left out a small item that makes a HUGE difference. its: src="<% =getUrl(); %>"
the = tells it to send the returned value, basically
Same as src="<% response.write(getUrl()) %>"
Either will work. I never use the ; inline in the aspx files either, but I dont program in c much, so im assuming you know what your doing there:) ciao!
click
|
|
Reply By:
|
gobotsoup
|
Reply Date:
|
3/9/2007 12:47:42 PM
|
Thanks A lot Works like a charm now!
|