Last active
April 6, 2017 21:13
-
-
Save jonedmiston/77a1d6650024c81c3229644d8e3787ef to your computer and use it in GitHub Desktop.
Page Attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ 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 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ CurrentPage | Attribute:'HeaderImage','Url' }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment