Master pages

An ASP.NET Master page defines the look and feel that you want to apply to all or some of the pages on your web site. Individual pages uses the master page to merge the page content with the master page content. The master page contains placeholders for content that can be specified in a page. Please look at the example below showing a master page and page that uses the master page.

<%@ master language="C#" autoeventwireup="true" codebehind="Site.Master.cs" inherits="MyProject.Lemoon.MasterPages.Site" %>
 
<!doctype html>
<html>
<head>
  <title><%: Site.Title %></title>
</head>
<body>
  <form runat="server">
    <asp:contentplaceholder id="mainplh" runat="server" />
  </form>
</body>
</html>

Code example 1. A master page with a content place holder.

<%@ page title="" language="C#" masterpagefile="~/Lemoon/MasterPages/Site.Master" autoeventwireup="true" codebehind="PageTemplate.aspx.cs" inherits="MyProject.Lemoon.Templates.PageTemplate" %>
 
<asp:content contentplaceholderid="mainplh" runat="server">
  <h1><%: Content.Title %></h1>
  <%= Content.Body %>
</asp:content>

Code example 2. A page that uses the master page

Master pages in Lemoon

By inheriting from the MasterPageBase class all Lemoon services are instantiated and ready to be used. You will also get access to Lemoon specific objects (like the current Content and Site etc.)

using System;
using System.Web;
using Mindroute.Core;
using Mindroute.Lemoon.Web.UI;
 
namespace MyProject.Lemoon.MasterPages {
    public partial class Site : MasterPageBase {
protected override void OnInit(EventArgs e) { base.OnInit(e);
} } }

Code example 3. A master page that inherits from MasterPageBase.