tags:

views:

85

answers:

3

I need to generate a composite page made up of other pages in our system.

Is it possible for me to dynamically add iFrames to a page, each with its own src pointing to different URLs which are determined on the fly? If so, is there a preferred method to this?

Otherwise I need to refactor the other pages into user controls so I can add them as needed.

+1  A: 

Although I'd seriously consider revising your pages to usercontrols if you'd like the "pages" to interact with each other. But for the question itself: you could add LiteralControls to your page (containing the iFrames) or to a placeholder.

PlaceHolder1.Controls.Add(new LiteralControl("<iframe src='mypage.aspx'></iframe>"));
riffnl
A: 

You could use the Document Object Model (DOM) / Javascript [1,2] to add iframes to your page. If you'd better like c# you'll have to postback before modifying the document I think (I'm not an expert in c# / asp).

dhh
A: 

You can do this the same way you dynamically add any .net control to a page, but you need to add an HtmlGenericControl

Ben Robinson