Dynamic Content Items

iParts

Display control - iPartDisplayBase

HideContent property

To use this property the design-time control code-behind (*Display.ascx.cs) should be inheriting from the iPartDisplayBase.

HideContent is a boolean property. When this property is set to true, the iParts display control is hidden from the page. When Easy Edit is enabled, a dotted border will surround the edit icon of the iPart.

Some iParts are designed to only show functionality if a set of criteria is met. For instance, a "Pay invoices link" should only appear if the user has currently unpaid invoices. Also, the Contact Account Creator may be configured to show conditionally depending on whether the user is authenticated or not.

The following code example will hide the content if the contact is not authenticated.

protected override void OnPreRender(EventArgs e)
{
	base.OnPreRender(e);

	if (!SecurityHelper.IsAuthenticatedUser)
		HideContent = true;
}

Configuration dialog control - iPartEditBase

Hide configuration options

To hide un-needed configuration options the design-time control code-behind (*ConfigEdit.ascx.cs) should be inheriting from the iPartEditBase.

Use the following example to hide any options.

System.Collections.Generic

protected override void OnInit(EventArgs e)
{
	HideConfigurationOptions();
	base.OnInit(e);
}

private void HideConfigurationOptions()
{
	if (HiddenConfigurationOptions == null)
		HiddenConfigurationOptions = new List<HideConfiguration>();
	HiddenConfigurationOptions.Add(HideConfiguration.PartTitle);
	HiddenConfigurationOptions.Add(HideConfiguration.CssClass);
	HiddenConfigurationOptions.Add(HideConfiguration.ShowBorder);
	HiddenConfigurationOptions.Add(HideConfiguration.Collapsible);
	HiddenConfigurationOptions.Add(HideConfiguration.DisplayOnExtraSmallScreens);
	HiddenConfigurationOptions.Add(HideConfiguration.DisplayOnSmallScreens);
	HiddenConfigurationOptions.Add(HideConfiguration.DisplayOnMediumScreens);
	HiddenConfigurationOptions.Add(HideConfiguration.DisplayOnLargeScreens);
	HiddenConfigurationOptions.Add(HideConfiguration.DoNotRenderInDesignMode);
	HiddenConfigurationOptions.Add(HideConfiguration.LicenseKeyRestriction);
	HiddenConfigurationOptions.Add(HideConfiguration.ModuleSpecificSetting);
	EnsureChildControls();
}