-
-
Save islaytitans/727f22d172831227d497 to your computer and use it in GitHub Desktop.
Splash Panel code behind
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
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