473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

including several pages in one aspx page

hello all.

i'm used to scripting in php. there, you just include(bla.php) and it
works. so i have a template that defines my layout and stays the same
forever, but in that file, there's a table that's filled in with other
pages, header.php, footer.php, menubar.php,

i was trying to do the same with .net, but every page i try to include has
his own page directive (well, i need the code behind... so i can't just
delete those page directives), so .net wont allow it.

is there another way to do this? i read about master pages, but that's not
until .net v2...

tnx in advance,

roger

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
4 1703
Tim
Hello,
Is this something you could solve with UserControls?

Many developer's successfully abstract Headers, Footers, and Menus to their
own user controls. You can then drag many UserControls onto a single ASPX
page.

Tim
http://timstall.dotnetdevelopersjournal.com/

"roger janssens via DotNetMonster.com" wrote:
hello all.

i'm used to scripting in php. there, you just include(bla.php) and it
works. so i have a template that defines my layout and stays the same
forever, but in that file, there's a table that's filled in with other
pages, header.php, footer.php, menubar.php,

i was trying to do the same with .net, but every page i try to include has
his own page directive (well, i need the code behind... so i can't just
delete those page directives), so .net wont allow it.

is there another way to do this? i read about master pages, but that's not
until .net v2...

tnx in advance,

roger

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2
Roger,

Actually, you don't have to wait for ASP.NET 2! Create yourself an .ASPX
page that will be the basis for the rest of your pages. In fact, call it
"BasePage.aspx". (Make this change in the "add new web form page" dialog
box because it'll make my message here shorter!) Add your style sheet,
header, footer, menubar, etc - and as Tim suggested, make your
header/footer/menubar into user controls.

Then when you create a new page, hop to the code-behind. (Click the "all
files" icon in your solution explorer, or right-click the .aspx file in the
solution explorer and choose "view code" to find the .aspx.cs file) Look
for this line:

public class TheNewBlankPageYouAdded : System.Web.UI.Page

Change it to:

public class TheNewBlankPageYouAdded : BasePage

What you're doing is changing the inheritance of the new web form. Instead
of inheriting directly from System.Web.UI.Page, as all Web Forms do, you're
inheriting from your new BasePage class. Since BasePage inherited from
System.Web.UI.Page, you're basically getting a web form with all of
BasePage's changes.

Note you may need to save TheNewBlankPageYouAdded.aspx , close it (from
VS.NET IDE), and re-open it to see the changes take effect in your design
environment.

So the old way you did things was to create your template page, and
cut/paste that template code into every PHP page, correct? Well, this new
way is based on the same thing; creating a template page- but instead of
cutting/pasting that code into every file, you just change the inheritance.

Tip: If your user controls (header, footer, menu) have text that changes;
set their properties up in the TheNewBlankPageYouAdded.Page_Load event.

It's a big adjustment curve going from a straight "scripting" language (and
all the inherent tricks you need to do) to a powerful "object orientated"
language, but it's well worth it!! Classic ASP was a straight-up scripting
language, just like PHP is- if you could do classic ASP, you could do PHP.
Think of ASP.NET as Java (object orientated) and you'll be fine.

Oh, my example assumes the C#.NET lanugage, but it should be very similar
with VB.NET.

-Thomas H

"roger janssens via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in
message news:b6******************************@DotNetMonste r.com...
hello all.

i'm used to scripting in php. there, you just include(bla.php) and it
works. so i have a template that defines my layout and stays the same
forever, but in that file, there's a table that's filled in with other
pages, header.php, footer.php, menubar.php,

i was trying to do the same with .net, but every page i try to include has
his own page directive (well, i need the code behind... so i can't just
delete those page directives), so .net wont allow it.

is there another way to do this? i read about master pages, but that's not
until .net v2...

tnx in advance,

roger

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #3
you wouldn't happen to have a link to some tutorial for that, would you?

either way, thanks for the hint. i'll google a bit myself too.

more advices welcome!

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #4
Tim
Hello,
UserControls are pretty common. Here's a quick tutorial:
http://samples.gotdotnet.com/quickst...bpagelets.aspx

Tim
http://timstall.dotnetdevelopersjournal.com/

"roger janssens via DotNetMonster.com" wrote:
you wouldn't happen to have a link to some tutorial for that, would you?

either way, thanks for the hint. i'll google a bit myself too.

more advices welcome!

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Title: What are the Consequences of Aspx page separate from app DLL Hi JL; I am working on a big asp.net application. When we migrate the dll (or dlls) to the production server, all users who are...
0
by: Santa | last post by:
I am using Fritz Onion's "Asynchronous Pages" approach as mentioned in the article http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx to increase the performance of my ASPX...
0
by: Santa | last post by:
I am using Fritz Onion's "Asynchronous Pages" approach as mentioned in the article http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx to increase the performance of my ASPX...
2
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! When i develop my web application i have a set of javascript that is used in several pages. Also the title is the same for all pages. And certain controls have events that are in the...
3
by: Tams TS | last post by:
Hi, am in trouble , please giv me some solution. scenario is like this; I have some asp pages and which are commerce server 2000 generated pages and going further am adding one aspx page to the...
3
by: thedebugger | last post by:
Dear Friends, I am working on website application in c# with asp.net. My practice using aspx files is, I have 1 main aspx files for inside pages. Whenever user hit the button like aboutus,...
4
by: Greg | last post by:
I migrated my 1.1 web project to 2.0, it ran through the convertor with no problems however several pages were not updated to say CodeFile and still say CodeBehind, along with many other compile...
1
by: epower | last post by:
Hello, I am working on an ASP .NET application in Visual Studio 2005 and running IE7. This application has a page that contains an iframe which loads an .aspx page and hyperlinks that...
1
by: Afshar | last post by:
Hi all friends, I have a big aspnet project including several several .aspx .ascx .resx. I publish this project everytime that i want to deploy it. I use full compile-no update options so I just...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.