Master Page Support in ASP.NET 1.1

We know that ASP.NET 2.0 has introduced the Masterpages.

but some us might be thinking is there any way to do this in ASP.NET 1.1.

ASP.NET 1.1 doesnot directly supports it. But you can do it using Spring.NET Web Application Framwork. The Spring.Web framework provides a nice set of features through which we can enable master page support in ASP.NET 1.1 applications.

The best link you can look in is (Chapter 22.6. Support for ASP.NET 1.1 master pages in Spring.Web)

A sample master page (MasterLayout.ascx) – A User Control could look like this:

HTML
</p>
<p><%@ Control language="c#" Codebehind="MasterLayout.ascx.cs" AutoEventWireup="false" Inherits="MyApp.Web.UI.MasterLyout" %><br />
<%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %><br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" &gt;<br />
<html><br />
    <head><br />
        <title>Master Page</title><br />
        <link rel="stylesheet" type="text/css" href="<%= Context.Request.ApplicationPath %>/css/styles.css"><br />
        <spring:ContentPlaceHolder id="head" runat="server"/><br />
    </head><br />
    <body><br />
        <form runat="server"><br />
            <table cellPadding="3" width="100%" border="1"><br />
                <tr><br />
                    <td colspan="2><br />
                        <spring:ContentPlaceHolder id="title" runat="server"><br />
                            <!-- default title content --><br />
                        </spring:ContentPlaceHolder><br />
                    </td><br />
                </tr><br />
                <tr><br />
                    <td><br />
                        <spring:ContentPlaceHolder id="leftSidebar" runat="server"><br />
                            <!-- default left side content --><br />
                        </spring:ContentPlaceHolder><br />
                    </td><br />
                    <td><br />
                        <spring:ContentPlaceHolder id="main" runat="server"><br />
                            <!-- default main area content --><br />
                        </spring:ContentPlaceHolder><br />
                    </td><br />
                </tr><br />
            </table><br />
        </form><br />
    </body><br />
</html></p>
<p>

We can have an ASPX page that uses this master page (Child.aspx) might look like this:

HTML
</p>
<p><%@ Register TagPrefix="spring" Namespace="Spring.Web.UI.Controls" Assembly="Spring.Web" %><br />
<%@ Page language="c#" Codebehind="Child.aspx.cs" AutoEventWireup="false" Inherits="ArtFair.Web.UI.Forms.Child" %><br />
<html><br />
    <body></p>
<p>        <spring:Content id="leftSidebarContent" contentPlaceholderId="leftSidebar" runat="server"&><br />
            <!-- left sidebar content --><br />
        </spring:Content></p>
<p>        <spring:Content id="mainContent" contentPlaceholderId="main" runat="server"><br />
            <!-- main area content --><br />
        </spring:Content></p>
<p>    </body><br />
</html><br />

The & control in the example uses the contentPlaceholderId attribute (property) to specify exactly which placeholder from the master page is to be overridden. Because this particular page does not define content elements for the head and title placeholders, the content elements are defined by the default content supplied in the master page.

Both the ContentPlaceHolder and Content controls can contain any valid ASP.NET markup: HTML, standard ASP.NET controls, user controls, and so on.

Cool right!!!. Hope this helps. Happy Coding Guys!!. You might wonder, is any one still using asp.net 1.1? Ya, It’s the very basic ASP.NET 1.1, you can learn about .NET 1.1 from the scratch. I love using .NET 1.1


Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

WordPress database error: [User 'dataadl336' has exceeded the 'max_questions' resource (current value: 40000)]
SELECT SQL_CALC_FOUND_ROWS cmxg4_comments.comment_ID FROM cmxg4_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1770 AND comment_type NOT IN ('note') ORDER BY cmxg4_comments.comment_date_gmt ASC, cmxg4_comments.comment_ID ASC

Leave a comment

Your email address will not be published. Required fields are marked *

WordPress database error: [User 'dataadl336' has exceeded the 'max_questions' resource (current value: 40000)]
SELECT option_value FROM cmxg4_options WHERE option_name = 'akismet_comment_nonce' LIMIT 1

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WordPress database error: [User 'dataadl336' has exceeded the 'max_questions' resource (current value: 40000)]
SELECT option_value FROM cmxg4_options WHERE option_name = 'cookie_consent_template' LIMIT 1

WordPress database error: [User 'dataadl336' has exceeded the 'max_questions' resource (current value: 40000)]
SELECT option_value FROM cmxg4_options WHERE option_name = 'jpsq_sync_checkout'

WordPress database error: [User 'dataadl336' has exceeded the 'max_questions' resource (current value: 40000)]
SELECT COUNT(*) FROM cmxg4_jetpack_sync_queue WHERE queue_id = 'sync'