|
-
Apr 24th, 2013, 02:01 PM
#1
Thread Starter
PowerPoster
Including an .ASPX page within another .ASPX Page?
I have an old ASP application that I am converting to .Net. One of my issues is that in the old ASP app, their was a page that had a statement like this: <!--#Include file='topNav.asp'-->. Now I know all this does is insert this other ASP page in a particular location within the current page. By the way, this page is a navigation page that displays a horizontal menu.
So, my question is, how can I incorporate this same page within a new ASPX page. I was told one way would be to create a UserControl but I'm not sure how to do that. I'm looking for other possibilities before resorting to UC.
Thanks,
-
Apr 24th, 2013, 07:44 PM
#2
Re: Including an .ASPX page within another .ASPX Page?
Sounds to me like you're wanting a MasterPage for the header & menu and whatnot, then a ContentPage for each actual page.
You can make the header and menu as a control, but I would still use a MasterPage to bring it all together.
-
Apr 24th, 2013, 11:34 PM
#3
Thread Starter
PowerPoster
Re: Including an .ASPX page within another .ASPX Page?
-
May 2nd, 2013, 09:48 AM
#4
Re: Including an .ASPX page within another .ASPX Page?
While I agree with JBs suggestion that you rewrite this using a master Page, you might find that an IFrame provides a quicker, dirtier solution. It basically just lets you host one page inside another so you could just add it to your new page and drop your menu page straight into it. You can't communicate between the pages, though, so it's not suitable to all scenarios.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
May 8th, 2013, 07:18 AM
#5
Re: Including an .ASPX page within another .ASPX Page?
 Originally Posted by FunkyDexter
You can't communicate between the pages, though, so it's not suitable to all scenarios.
This is not "strictly" true. If required, and assuming the pages were coming from the same server, use JavaScript to call into the parent page, from the page within the iFrame. This is even more "dirty", but is possible 
Gary
-
May 8th, 2013, 09:46 AM
#6
Re: Including an .ASPX page within another .ASPX Page?
 Originally Posted by FunkyDexter
While I agree with JBs suggestion that you rewrite this using a master Page, you might find that an IFrame provides a quicker, dirtier solution. It basically just lets you host one page inside another so you could just add it to your new page and drop your menu page straight into it. You can't communicate between the pages, though, so it's not suitable to all scenarios.
 Originally Posted by gep13
This is not "strictly" true. If required, and assuming the pages were coming from the same server, use JavaScript to call into the parent page, from the page within the iFrame. This is even more "dirty", but is possible
Gary
In my personal opinion, the iFrame used to serve a really good purpose in the early days of the web though using JS to build a url string to pass parameters to the iFrame page is much more of a pain than I would care to deal with.
These days, at least with .Net, there are far more options to handle this kind of scenario and everything I would use an iFrame in the classic asp days I can replace with a MasterPage/ContentPage ideology. In the long run I find it to be a much cleaner solution and is far easier to keep track of and maintain. Just my 2 cents.
-
May 8th, 2013, 09:57 AM
#7
Re: Including an .ASPX page within another .ASPX Page?
 Originally Posted by JuggaloBrotha
In my personal opinion, the iFrame used to serve a really good purpose in the early days of the web though using JS to build a url string to pass parameters to the iFrame page is much more of a pain than I would care to deal with.
These days, at least with .Net, there are far more options to handle this kind of scenario and everything I would use an iFrame in the classic asp days I can replace with a MasterPage/ContentPage ideology. In the long run I find it to be a much cleaner solution and is far easier to keep track of and maintain. Just my 2 cents.
I don't disagree. The only reason that I would continue to suggest an iFrame, in this case, is because the page already exists, and can be used as is. Implementing the Master/Content Pages, although the "correct" approach, would involve a lot of effort, which the OP might not have. In which case, an interim step of using an iFrame might be required.
Gary
-
May 9th, 2013, 06:46 AM
#8
Re: Including an .ASPX page within another .ASPX Page?
And neither do I I was really just throwing out the quick and dirty alternative.
This is not "strictly" true.
I did try that on a recent project I inherited which has an IFrame in it. I basically wanted to push a button in the iframe page when a button was pushed in the main page. It was a total nightmare and I eventually gave up and went a different route. I figured saying that it was impossible was close enough to be true to be useful.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|