Articles → .NET → Page Template in .net 1.1

Page Template in .net 1.1

Software requirement

Prerequisite knowledge

Creation of base class

using System;
using System.Web.UI;

public class PageBase : System.Web.UI.Page
    private string _pageTitle;
    public string PageTitle
        get { return _pageTitle; }
        set { _pageTitle = value; }

    protected override void Render(HtmlTextWriter writer)
        // First we will build up the html document, 
        // the head section and the body section.
                    <title>" + PageTitle + @"</title>

        // Then we allow the base class to render the 
        // controls contained in the ASPX file.

        // Finally we render the final tags to close
        // the document.

Create a web page

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<form id="SimplePageInheritance" method="post" runat="server">    
        This is the sample of the page with master page like feature 
        without using master page.

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : PageBase
    protected void Page_Load(object sender, EventArgs e)
        PageTitle = "test";


Click to Enlarge


Posted By  -  Karan Gupta
Posted On  -  Wednesday, September 15, 2010


Your Email Id  
Query/FeedbackCharacters remaining 250