I have an asp.net website with a master-page, can I use the iframe
so my .aspx
pages will load inside the iframes
. (Meaning it wont load the master-page)
Kinda like my iframe
will be the contentplaceholder
or maybe the contentplaceholder
will be inside it?
Any Ideas?
try this
Expose this iframe in the master page's codebehind:
Add the MasterType directive for the content page to strongly typed Master Page.
In code behind
How about:
Is supported since .Net Framework 4.5
If you have Problems using this control, you might take a look here.
You can think of an iframe as an embedded browser window that you can put on an HTML page to show another URL inside it. This URL can be totally distinct from your web site/app.
You can put an iframe in any HTML page, so you could put one inside a contentplaceholder in a webform that has a Masterpage and it will appear with whatever URL you load into it (via Javascript, or C# if you turn your iframe into a server-side control (
runat='server'
) on the final HTML page that your webform produces when requested.And you can load a URL into your iframe that is a
.aspx
page.But - iframes have nothing to do with the ASP.net mechanism. They are HTML elements that can be made to run server-side, but they are essentially 'dumb' and unmanaged/unconnected to the ASP.Net mechanisms - don't confuse a Contentplaceholder with an iframe.
Incidentally, the use of iframes is still contentious - do you really need to use one? Can you afford the negative trade-offs associated with them e.g. lack of navigation history ...?
Another option is to use placeholders.
Html:
C#: