Click here to Skip to main content
15,884,177 members
Articles / Web Development / ASP.NET

ASP.NET Page Templates - Using Inheritance

Rate me:
Please Sign up or sign in to vote.
4.76/5 (135 votes)
19 Sep 20028 min read 1.4M   11.8K   304  
A tutorial showing how to create page templates that use object-oriented inheritance.
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="PageInheritanceSample._Default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>Default</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
	</HEAD>
	<body>
		<form id="Default" method="post" runat="server">
			<P><STRONG>Page Inheritance Sample</STRONG></P>
			<UL>
				<LI>
					<A href="SimplePageInheritance.aspx">SimplePageInheritance.aspx</A>
				- this page demonstrates Simple Page Inheritance, which is faster that Advanced 
				Page Inheritance but you cannot use most server controls in the template
				<LI>
					<A href="AdvancedPageInheritance.aspx">AdvancedPageInheritance.aspx</A>
				- this page demonstrates Advanced Page Inheritance, a little bit slower than 
				Simple Page Inheritance, but you can put any server controls in the template
				<LI>
					<A href="WebUserControl.aspx">WebUserControl.aspx</A> - for comparison and 
					performance testing, the same template used in the previous two samples is 
					implemented using Web User Controls.</LI></UL>
		</form>
	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Peter Provost has been programming computers since he was 10 years old. Currently a C# and C++ junkie, he has been developing on the Windows platform since Windows 286.

Peter is a Software Design Engineer with Microsoft's patterns and practices team where he works on guidance for .NET developers.

Peter maintains an active weblog about technology, .NET and other interesting stuff at http://www.peterprovost.org

Comments and Discussions