Skip to content

Instantly share code, notes, and snippets.

@islaytitans
Created July 13, 2015 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save islaytitans/727f22d172831227d497 to your computer and use it in GitHub Desktop.
Save islaytitans/727f22d172831227d497 to your computer and use it in GitHub Desktop.
Splash Panel code behind
public partial class SplashPanel : UserControl
{
private Item _dataSource;
public Item DataSource
{
get
{
if (_dataSource == null)
{
var parent = Parent as Sublayout;
if (parent != null)
_dataSource = Sitecore.Context.Database.GetItem(parent.DataSource);
}
return _dataSource;
}
}
protected void Page_Load(object sender, EventArgs e)
{
titleText.Item = DataSource;
straplineText.Item = DataSource;
clickThroughLink.Item = DataSource;
Sitecore.Data.Fields.ImageField imageField = DataSource.Fields["image"];
dPanel.Attributes.Add("style", "background-image:url(\"" + MediaManager.GetMediaUrl(imageField.MediaItem) + "\")");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment