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

Page Template Framework for ASP.NET 1.1

Rate me:
Please Sign up or sign in to vote.
4.64/5 (63 votes)
16 Nov 20048 min read 298.1K   5.3K   168  
The Page Template Framework for ASP.NET 1.1 provides a configurable solution for creating page templates in a Web application. Using this framework, page templates are stored in an XML file, and can be dynamically configured without recompiling the Web application.
using System;
using System.Collections;
using System.Xml.Serialization;

namespace Boardworks.Web.UI.PageFramework.Config
{
	/// <summary>
	/// Represents the Page Templates available within the PageConfig
	/// </summary>
	[XmlRoot("PageTemplates")]
	public class PageTemplateCollection : System.Collections.CollectionBase
	{
		/// <summary>
		/// Indexer that will return the PageTemplate at the specified index
		/// </summary>
		[XmlArrayItem("PageTemplate")]
		public PageTemplate this[int index]
		{
			get
			{
				// Return the PageTemplate from the internal IList at the specified index
				return (PageTemplate)this.List[index];
			}
			set
			{
				// Store the specified PageTemplate in the internal IList
				this.List[index] = value;
			}
		}


		/// <summary>
		/// Method that will Add a PageTemplate to the PageTemplateCollection
		/// </summary>
		/// <param name="pageTemplate">The PageTemplate to add</param>
		public void Add(PageTemplate pageTemplate)
		{
			// Add the specified PageTemplate to the internal IList
			this.List.Add(pageTemplate);
		}


		/// <summary>
		/// Method that will insert the specified PageTemplate to the 
		/// PageTemplateCollection at the specified index
		/// </summary>
		/// <param name="index">The index at which to PageTemplate should be inserted</param>
		/// <param name="pageTemplate">The PageTemplate to insert into the PageTemplateCollection</param>
		public void Insert(int index, PageTemplate pageTemplate)
		{
			// Insert the specified PageTemplate to the internal IList
			this.List.Insert(index, pageTemplate);
		}


		/// <summary>
		/// Method that will remove the specified PageTemplate from the PageTemplateCollection
		/// </summary>
		/// <param name="pageTemplate">The PageTemplate to be removed from the PageTemplateCollection</param>
		public void Remove(PageTemplate pageTemplate)
		{
			this.List.Remove(pageTemplate);
		}


		/// <summary>
		/// Method that will return the index of the specified PageTemplate in the PageTemplateCollection
		/// </summary>
		/// <param name="pageTemplate">The PageTemplate whose index is being requested</param>
		/// <returns>The index of the specified PageTemplate in the PageTemplateCollection</returns>
		public int IndexOf(PageTemplate pageTemplate)
		{
			// Obtain the index of the PageTemplate from the interal IList
			return this.List.IndexOf(pageTemplate);
		}


		/// <summary>
		/// Method that will determine if the specified PageTemplate exists in the PageTemplateCollection
		/// </summary>
		/// <param name="page">The PageTemplate to be located</param>
		/// <returns>A boolean value indicated whether or not the PageTemplateCollection contains the specified PageTemplate</returns>
		public bool Contains(PageTemplate pageTemplate)
		{
			// Check to see if the PageTemplate exists in the internal IList
			return this.List.Contains(pageTemplate);
		}	
	}
}

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
Scott Van Vliet is a Principal Consultant with Neudesic based in Irvine, CA. He has been designing and developing technology solutions for the past 8 years, and has worked with Microsoft .NET technologies for over 3 years. Scott is currently developing solutions with ASP.NET 2.0, C# 2.0, Windows Presentation Foundation (codename "Avalon"), SQL Server 2000/2005, Reporting Services and SharePoint.

Scott welcomes feedback and can be reached through his Weblog at http://weblogs.asp.net/skillet/.

Comments and Discussions