Skip to content

Instantly share code, notes, and snippets.

@jonedmiston
Last active April 6, 2017 21:13
Show Gist options
  • Save jonedmiston/77a1d6650024c81c3229644d8e3787ef to your computer and use it in GitHub Desktop.
Save jonedmiston/77a1d6650024c81c3229644d8e3787ef to your computer and use it in GitHub Desktop.
Page Attributes
<%@ Page Language="C#" MasterPageFile="Site.Master" AutoEventWireup="true" Inherits="Rock.Web.UI.RockPage" %>
<%@ Import Namespace="Rock.Web.UI" %>
<%@ Import Namespace="Rock.Web.Cache" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
var page = (RockPage)this.Page;
//var page = PageCache.Read(((RockPage)this.Page).PageId);
var headerImage = page.GetAttributeValue( "HeaderImage" );
divTest.InnerText = headerImage;
var body = (HtmlGenericControl)this.Master.FindControl( "body" );
if ( body != null )
{
if (body.Attributes["class"] != null )
{
body.Attributes["class"] += " layout-class";
}
else
{
body.Attributes.Add( "class", "layout-class" );
}
}
}
</script>
<div id="divTest" runat="server"></div>
<!-- NOTE: the div must have an id and runat=server -->
{{ CurrentPage | Attribute:'HeaderImage','Url' }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment