Created
January 21, 2012 08:02
-
-
Save vman/1651977 to your computer and use it in GitHub Desktop.
Custom Action for CSS
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 override void FeatureActivated(SPFeatureReceiverProperties properties) | |
{ | |
//Add the Css to the current Web | |
SPSite site = properties.Feature.Parent as SPSite; | |
SPWeb web = site.OpenWeb(); | |
if (web.ServerRelativeUrl == "/") | |
{ | |
web.AlternateCssUrl = web.ServerRelativeUrl + "SiteAssets/Styles/mystyles.css"; | |
} | |
else | |
{ | |
web.AlternateCssUrl = web.ServerRelativeUrl + "/SiteAssets/Styles/mystyles.css"; | |
} | |
web.Update(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment