Hi Shaun,
I would just create a simple UserControl, then declare the UserControl in the layout.master using Register something like this:
<%@ Register Src="~/pathtoyour.ascx" TagName="PageNameControl" TagPrefix="co" %>
Then add the control in layout.master like:
<co:PageNameControl id="pn1" runat="server" />
Then the code for a simple UserControl would be about like this (not tested):
<%@ Control Language="C#" AutoEventWireup="true" ClassName="PageNameControl.ascx" Inherits="System.Web.UI.UserControl" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="mojoPortal.Business" %>
<%@ Import Namespace="mojoPortal.Business.WebHelpers" %>
<%@ Import Namespace="mojoPortal.Web.Framework" %>
<%@ Import Namespace="mojoPortal.Web.Controls" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
PopulateControls();
}
private void PopulateControls()
{
PageSettings currentPage = CacheHelper.GetCurrentPage();
if(currentPage == null){ return; }
lblPageName.Text = currentPage.PageName;
}
</script>
<asp:Label ID="lblPageName" runat="server" />
Hope it helps,
Joe