By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

filling iframe with web page

P: n/a
pb
Hi all,

I have some code that automatically generates a url depending on user
selections. This url is then set as a hyperlink and the user clicks on
the link that has the target as an iframe on the same page.

What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on the
link first.

- the content of the hyperlink are set in code based on user input...

<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />

- this frame is filled when the user clicks the hyperlink, but I would
like it automatically filled server side.

<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>

Jun 1 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
set the iframe src to the url you'd put in the hyperlink.

<iframe src="<%=GetIframeUrl()%>">

where GetIframeUrl is a method return the url string

-- bruce (sqlwork.com)

pb wrote:
Hi all,

I have some code that automatically generates a url depending on user
selections. This url is then set as a hyperlink and the user clicks on
the link that has the target as an iframe on the same page.

What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on the
link first.

- the content of the hyperlink are set in code based on user input...

<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />

- this frame is filled when the user clicks the hyperlink, but I would
like it automatically filled server side.

<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>
Jun 1 '07 #2

P: n/a
pb
On Jun 2, 9:35 am, bruce barker <nos...@nospam.comwrote:
set the iframe src to the url you'd put in the hyperlink.

<iframe src="<%=GetIframeUrl()%>">

where GetIframeUrl is a method return the url string

-- bruce (sqlwork.com)

pb wrote:
Hi all,
I have some code that automatically generates a url depending on user
selections. This url is then set as a hyperlink and the user clicks on
the link that has the target as an iframe on the same page.
What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on the
link first.
- the content of the hyperlink are set in code based on user input...
<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />
- this frame is filled when the user clicks the hyperlink, but I would
like it automatically filled server side.
<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>- Hide quoted text -

- Show quoted text -
Thanks bruce, I tried that but it doesn't seem to do anything. Am I
missing something?

<iframe
src="<%# GetMapUrl()%>"
runat=server
</iframe>
Function GetMapUrl() As String

GetMapUrl = "WWW.WHATEVER"

End Function

Jun 2 '07 #3

P: n/a
You haven't closed your iframe opener tag.

Doesn't your getmapurl function need to "return" the string? (I come from a
classic ASP background but predominantly write in C# now, so not sure...)

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"pb" <ph**********@hotmail.comwrote in message
news:11**********************@x35g2000prf.googlegr oups.com...
On Jun 2, 9:35 am, bruce barker <nos...@nospam.comwrote:
>set the iframe src to the url you'd put in the hyperlink.

<iframe src="<%=GetIframeUrl()%>">

where GetIframeUrl is a method return the url string

-- bruce (sqlwork.com)

pb wrote:
Hi all,
I have some code that automatically generates a url depending on user
selections. This url is then set as a hyperlink and the user clicks on
the link that has the target as an iframe on the same page.
What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on the
link first.
- the content of the hyperlink are set in code based on user input...
<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />
- this frame is filled when the user clicks the hyperlink, but I would
like it automatically filled server side.
<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>- Hide quoted text -

- Show quoted text -

Thanks bruce, I tried that but it doesn't seem to do anything. Am I
missing something?

<iframe
src="<%# GetMapUrl()%>"
runat=server
</iframe>
Function GetMapUrl() As String

GetMapUrl = "WWW.WHATEVER"

End Function

Jun 2 '07 #4

P: n/a
pb
On Jun 3, 4:08 am, "David"
<david.colliver.N...@revilloc.REMOVETHIS.comwrot e:
You haven't closed your iframe opener tag.

Doesn't your getmapurl function need to "return" the string? (I come from a
classic ASP background but predominantly write in C# now, so not sure...)

--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com- Local franchises available

"pb" <philbrier...@hotmail.comwrote in message

news:11**********************@x35g2000prf.googlegr oups.com...
On Jun 2, 9:35 am, bruce barker <nos...@nospam.comwrote:
set the iframe src to the url you'd put in the hyperlink.
<iframe src="<%=GetIframeUrl()%>">
where GetIframeUrl is a method return the url string
-- bruce (sqlwork.com)
pb wrote:
Hi all,
I have some code that automatically generates a url depending on user
selections. This url is then set as a hyperlink and the user clicks on
the link that has the target as an iframe on the same page.
What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on the
link first.
- the content of the hyperlink are set in code based on user input...
<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />
- this frame is filled when the user clicks the hyperlink, but I would
like it automatically filled server side.
<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>- Hide quoted text -
- Show quoted text -
Thanks bruce, I tried that but it doesn't seem to do anything. Am I
missing something?
<iframe
src="<%# GetMapUrl()%>"
runat=server
</iframe>
Function GetMapUrl() As String
GetMapUrl = "WWW.WHATEVER"
End Function- Hide quoted text -

- Show quoted text -
Thanks David & Bruce for the responses.

I had closed the tag - just missed it when copying a reduced version
of the code to post it here. The function works the same eitherway,
with or without a return.

I still don't get anything being filled in the frame though.

Phil

Jun 2 '07 #5

P: n/a
pb
On Jun 3, 7:39 am, pb <philbrier...@hotmail.comwrote:
On Jun 3, 4:08 am, "David"

<david.colliver.N...@revilloc.REMOVETHIS.comwrot e:
You haven't closed your iframe opener tag.
Doesn't your getmapurl function need to "return" the string? (I come from a
classic ASP background but predominantly write in C# now, so not sure...)
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com-Local franchises available
"pb" <philbrier...@hotmail.comwrote in message
news:11**********************@x35g2000prf.googlegr oups.com...
On Jun 2, 9:35 am, bruce barker <nos...@nospam.comwrote:
>set the iframe src to the url you'd put in the hyperlink.
><iframe src="<%=GetIframeUrl()%>">
>where GetIframeUrl is a method return the url string
>-- bruce (sqlwork.com)
>pb wrote:
Hi all,
I have some code that automatically generates a url depending on user
selections. This url is then set as a hyperlink and the user clicks on
the link that has the target as an iframe on the same page.
What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on the
link first.
- the content of the hyperlink are set in code based on user input...
<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />
- this frame is filled when the user clicks the hyperlink, but I would
like it automatically filled server side.
<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>- Hide quoted text -
>- Show quoted text -
Thanks bruce, I tried that but it doesn't seem to do anything. Am I
missing something?
<iframe
src="<%# GetMapUrl()%>"
runat=server
</iframe>
Function GetMapUrl() As String
GetMapUrl = "WWW.WHATEVER"
End Function- Hide quoted text -
- Show quoted text -

Thanks David & Bruce for the responses.

I had closed the tag - just missed it when copying a reduced version
of the code to post it here. The function works the same eitherway,
with or without a return.

I still don't get anything being filled in the frame though.

Phil- Hide quoted text -

- Show quoted text -

I've narrowed this down to my lack of understanding of how to return a
value from the function - I've only a VB6 background.
The following code demonstrates what I am trying to achieve. The fact
that hyp1 doesn't work means that NavigateUrl="<%# GetUrl()%>" is not
doing what I want it to do.

Please could someone tell me the obvious error? Much appreciated.

Cheers,

Phil

<%-- these dont work--%>
<iframe
src="<%# GetUrl()%>"
runat=server
frameborder=yes
name = "myframe"
width="200"
height="200">
</iframe>

<BR />

<asp:HyperLink
ID="hyp1"
runat="server"
Width="450px"
Target="myframe"
NavigateUrl="<%# GetUrl()%>"
>
Click here to fill the frame
</asp:HyperLink>

<br />

<%--this works --%>
<asp:HyperLink
ID="hyp2"
runat="server"
Width="450px"
Target="myframe"
NavigateUrl="HTTP://WWW.GOOGLE.COM"
>
Click here to fill the frame
</asp:HyperLink><br />

code behind...

Function GetUrl() As String
Return "http://www.google.com"
End Function

Jun 2 '07 #6

P: n/a
Perhaps someone can explain the difference of <%# and <%= to me (I am not
sure, but I thought that <%# was a databound value)

If it is databound, you might try in your page load, page.databind()
alternatively, try the <%=

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"pb" <ph**********@hotmail.comwrote in message
news:11*********************@q19g2000prn.googlegro ups.com...
On Jun 3, 7:39 am, pb <philbrier...@hotmail.comwrote:
>On Jun 3, 4:08 am, "David"

<david.colliver.N...@revilloc.REMOVETHIS.comwrote :
You haven't closed your iframe opener tag.
Doesn't your getmapurl function need to "return" the string? (I come
from a
classic ASP background but predominantly write in C# now, so not
sure...)
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com-Local franchises available
"pb" <philbrier...@hotmail.comwrote in message
>news:11**********************@x35g2000prf.googleg roups.com...
On Jun 2, 9:35 am, bruce barker <nos...@nospam.comwrote:
set the iframe src to the url you'd put in the hyperlink.
><iframe src="<%=GetIframeUrl()%>">
>where GetIframeUrl is a method return the url string
>-- bruce (sqlwork.com)
>pb wrote:
Hi all,
I have some code that automatically generates a url depending on
user
selections. This url is then set as a hyperlink and the user
clicks on
the link that has the target as an iframe on the same page.
What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on
the
link first.
- the content of the hyperlink are set in code based on user
input...
<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />
- this frame is filled when the user clicks the hyperlink, but I
would
like it automatically filled server side.
<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>- Hide quoted text -
>- Show quoted text -
Thanks bruce, I tried that but it doesn't seem to do anything. Am I
missing something?
<iframe
src="<%# GetMapUrl()%>"
runat=server
</iframe>
Function GetMapUrl() As String
GetMapUrl = "WWW.WHATEVER"
End Function- Hide quoted text -
- Show quoted text -

Thanks David & Bruce for the responses.

I had closed the tag - just missed it when copying a reduced version
of the code to post it here. The function works the same eitherway,
with or without a return.

I still don't get anything being filled in the frame though.

Phil- Hide quoted text -

- Show quoted text -


I've narrowed this down to my lack of understanding of how to return a
value from the function - I've only a VB6 background.
The following code demonstrates what I am trying to achieve. The fact
that hyp1 doesn't work means that NavigateUrl="<%# GetUrl()%>" is not
doing what I want it to do.

Please could someone tell me the obvious error? Much appreciated.

Cheers,

Phil

<%-- these dont work--%>
<iframe
src="<%# GetUrl()%>"
runat=server
frameborder=yes
name = "myframe"
width="200"
height="200">
</iframe>

<BR />

<asp:HyperLink
ID="hyp1"
runat="server"
Width="450px"
Target="myframe"
NavigateUrl="<%# GetUrl()%>"
>
Click here to fill the frame
</asp:HyperLink>

<br />

<%--this works --%>
<asp:HyperLink
ID="hyp2"
runat="server"
Width="450px"
Target="myframe"
NavigateUrl="HTTP://WWW.GOOGLE.COM"
>
Click here to fill the frame
</asp:HyperLink><br />

code behind...

Function GetUrl() As String
Return "http://www.google.com"
End Function

Jun 3 '07 #7

P: n/a
Actually, I think I have just worked it out...

<iframe
src="<%# GetUrl()%>"
runat=server
frameborder=yes
name = "myframe"
width="200"
height="200">
</iframe>

Give your iframe an ID (YourIFrameID here for demo)

Reference the iframe in your codebehind...

proected System.Web.HtmlControls.iframe YourIFrameID; // I might have got
the syntax slightly wrong.

Then in your event, i.e. Page_Load

YourFrameID.src = "http://www.google.com"; // Quotes around URL may get
lost in translation...

Remove the src attribute completely from your iframe.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"pb" <ph**********@hotmail.comwrote in message
news:11*********************@q19g2000prn.googlegro ups.com...
On Jun 3, 7:39 am, pb <philbrier...@hotmail.comwrote:
>On Jun 3, 4:08 am, "David"

<david.colliver.N...@revilloc.REMOVETHIS.comwrote :
You haven't closed your iframe opener tag.
Doesn't your getmapurl function need to "return" the string? (I come
from a
classic ASP background but predominantly write in C# now, so not
sure...)
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com-Local franchises available
"pb" <philbrier...@hotmail.comwrote in message
>news:11**********************@x35g2000prf.googleg roups.com...
On Jun 2, 9:35 am, bruce barker <nos...@nospam.comwrote:
set the iframe src to the url you'd put in the hyperlink.
><iframe src="<%=GetIframeUrl()%>">
>where GetIframeUrl is a method return the url string
>-- bruce (sqlwork.com)
>pb wrote:
Hi all,
I have some code that automatically generates a url depending on
user
selections. This url is then set as a hyperlink and the user
clicks on
the link that has the target as an iframe on the same page.
What is the easier way to automatically fill the iframe with the
required new web page without having to get the user to click on
the
link first.
- the content of the hyperlink are set in code based on user
input...
<asp:HyperLink
ID="hyperlinktoGoogleMaps"
runat="server"
Width="450px"
Target="MapFrame">
Click here to view your house
</asp:HyperLink><br />
- this frame is filled when the user clicks the hyperlink, but I
would
like it automatically filled server side.
<iframe scrolling=no
frameborder=no
marginwidth=0
marginheight=0
id="MapFrame"
name="MapFrame"
width="480"
height="480">
</iframe>- Hide quoted text -
>- Show quoted text -
Thanks bruce, I tried that but it doesn't seem to do anything. Am I
missing something?
<iframe
src="<%# GetMapUrl()%>"
runat=server
</iframe>
Function GetMapUrl() As String
GetMapUrl = "WWW.WHATEVER"
End Function- Hide quoted text -
- Show quoted text -

Thanks David & Bruce for the responses.

I had closed the tag - just missed it when copying a reduced version
of the code to post it here. The function works the same eitherway,
with or without a return.

I still don't get anything being filled in the frame though.

Phil- Hide quoted text -

- Show quoted text -


I've narrowed this down to my lack of understanding of how to return a
value from the function - I've only a VB6 background.
The following code demonstrates what I am trying to achieve. The fact
that hyp1 doesn't work means that NavigateUrl="<%# GetUrl()%>" is not
doing what I want it to do.

Please could someone tell me the obvious error? Much appreciated.

Cheers,

Phil

<%-- these dont work--%>
<iframe
src="<%# GetUrl()%>"
runat=server
frameborder=yes
name = "myframe"
width="200"
height="200">
</iframe>

<BR />

<asp:HyperLink
ID="hyp1"
runat="server"
Width="450px"
Target="myframe"
NavigateUrl="<%# GetUrl()%>"
>
Click here to fill the frame
</asp:HyperLink>

<br />

<%--this works --%>
<asp:HyperLink
ID="hyp2"
runat="server"
Width="450px"
Target="myframe"
NavigateUrl="HTTP://WWW.GOOGLE.COM"
>
Click here to fill the frame
</asp:HyperLink><br />

code behind...

Function GetUrl() As String
Return "http://www.google.com"
End Function

Jun 3 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.