Skip to content

Instantly share code, notes, and snippets.

@SitefinityGuru
Created July 27, 2012 18:26
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 SitefinityGuru/3189612 to your computer and use it in GitHub Desktop.
Save SitefinityGuru/3189612 to your computer and use it in GitHub Desktop.
Hideable Sitefinity Content Block Widget
public class HideableContentBlock : ContentBlock
{
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
// always render in page editor
if (this.IsDesignMode() || this.IsPreviewMode())
{
base.Render(writer);
return;
}
// exit if parameters are found
var urlParam = this.GetUrlParameters();
if (urlParam != null && urlParam.Length > 0) return;
base.Render(writer);
}
}
@SitefinityGuru
Copy link
Author

Be sure to include the namespace System.Web.UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment