Include Files in ASP.NET

G

Guest

Currently I have a site template using classic asp that uses include files to seperate content from display. How can I do something similar in ASP.NET/C# code behind. Mainly I need to seperate navgation header, side bar and content.

Any tips or techniques would be great.

Thanks, Justin.
 
G

Guest

You can still use <include> tag in ASP.NET or you can build UserControl to do that

Tu-Thac

----- Justin wrote: ----

Currently I have a site template using classic asp that uses include files to seperate content from display. How can I do something similar in ASP.NET/C# code behind. Mainly I need to seperate navgation header, side bar and content

Any tips or techniques would be great

Thanks, Justin.
 
M

Mark Fitzpatrick

Justin,
A lot of people use webcontrols to hold the content, such as a
header and footer, and then plop them onto pages as they need. Another
approach is very similar, except then instead of just loading the header and
footer into each and every page, you create a new base page class that
inherits from System.Web.Ui.Page that overrides the render event and loads
these controls for you automatically (inserting header at the beginning and
after the normal page rendering is done it loads and adds the footer
control). You can essentially make it as complicated or simple as you want
with these methods. Using your own header and footer controls is a good
place to start though as it does a very similar job to the SSI includes.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

Justin said:
Currently I have a site template using classic asp that uses include files
to seperate content from display. How can I do something similar in
ASP.NET/C# code behind. Mainly I need to seperate navgation header, side bar
and content.
 
S

Steve C. Orr [MVP, MCSD]

The most common replacement for old fashioned include files are web user
controls.
They basically are like object oriented include files on steroids.

Here's more info:
http://msdn.microsoft.com/library/d...n/html/vbconintroductiontowebusercontrols.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vboriwebusercontrols.asp
http://msdn.microsoft.com/library/d...l/vbconWebUserControlsVsCustomWebControls.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



Justin said:
Currently I have a site template using classic asp that uses include files
to seperate content from display. How can I do something similar in
ASP.NET/C# code behind. Mainly I need to seperate navgation header, side bar
and content.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,832
Latest member
UtaHetrick

Latest Threads

Top