display an aspx page on a panel

  • Thread starter Thread starter William LaMartin
  • Start date Start date
W

William LaMartin

Is there a way to place an aspx page on a panel contained on another aspx
page? I can display an HTML page on the panel using a literal can figure no
way to put and aspx page there.
 
Place an Iframe on the panel and set its source to your aspx page.

<div id="panel1" class="panel" >
<iframe name="iframe" src="your.aspx" class="iframe"> </iframe>
</div>
 
I have an aspx page I have already built using several ascx user controls.
I would like to display that page in a panel on another page.

The reason I did not add the user controls via code to the panel is that
when I try code like

Me.Panel1.Visible = True
Me.Panel1.Controls.Clear()
Dim MyHeader As New System.Web.UI.UserControl
MyHeader.LoadControl("header.ascx")
Me.Panel1.Controls.Add(MyHeader)

I get the error: The virtual path '/header.ascx' maps to another
application, which is not allowed. And I can find no way to get away from
the error message.

However, on a second look, I discovered that code like

Dim uc1 As Control = Page.LoadControl("header.ascx")
Me.Panel1.Controls.Add(uc1)

does not produce the error. so I can use the method you suggest. But now I
am curious as to why the first block of code produces the error and the
second doesn't.
 
Is there a way to add the iframe in code only? Something like

Dim MyIframe As New HtmlGenericControl
MyIframe.Attributes("SRC") = "Join.aspx"
Me.Panel1.Controls.Add(MyIframe)

which doesn nothing.
 
Back
Top