Want to be able to pass parameters to an IFRAME

R

Rod

I've got 2 ASP.NET WebPages that I've written in VB.NET 2003. One of them
has several controls on it, including at the bottom of the page an IFrame.
The second ASP.NET page is supposed to have parameters passed to it in the
query string. My problem is that I cannot figure out how to
programmatically change the parameters that are passed to the second ASP.NET
page, from the first ASP.NET page.

How is this done?

Rod
 
B

bruce barker

in aspx:

<iframe id="footer" runat=server >

in code behind

footer.Attributes["src"] = "page2.aspx?p1=" + HttpUtility.UrlEncode(p1);


-- bruce (sqlwork.com)
 
S

Steven Cheng[MSFT]

Hi Rod,

As for the dynamically setting querystring items passed to the inner iframe
page, I think bruce 's suggestion is qutie good. First declare the <iframe
runat="server" id="frm"> element as a HtmlGenericControl, such as
protected System.Web.UI.HtmlControls.HtmlGenericControl frm;

so t hat we can reference it in code behind and then change the "src"
atrribute as we like. In addition, if you want to make it in the aspx page
inline, you can also define a function to dynamically generate the
querysting items , for example:

<iframe id="frm" src="innerpage.aspx?<% BuildQueryString()%>">


"BuildQueryString" can be a public helper function in the page class that
generate the querystring list.
Hope also helps.Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
R

Rod

Thank you, Bruce, that did the trick.

Rod

bruce barker said:
in aspx:

<iframe id="footer" runat=server >

in code behind

footer.Attributes["src"] = "page2.aspx?p1=" + HttpUtility.UrlEncode(p1);


-- bruce (sqlwork.com)


Rod said:
I've got 2 ASP.NET WebPages that I've written in VB.NET 2003. One of them
has several controls on it, including at the bottom of the page an IFrame.
The second ASP.NET page is supposed to have parameters passed to it in the
query string. My problem is that I cannot figure out how to
programmatically change the parameters that are passed to the second ASP.NET
page, from the first ASP.NET page.

How is this done?

Rod
 
R

Rod

Hi Steven,

You are correct, Bruce's suggest works like a charm. Your suggestion for
making a making a function to dynamically build the querystring looks as
though it would add to what Bruce provided.

Rod
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top