Class DynamicContentEditControl
An abstract base class that should be inherited from when you implement a custom settings UI for a dynamic content adapter.
Inheritance
Namespace: EPiServer.DynamicContent
Assembly: EPiServer.dll
Version: 9.12.2Syntax
public abstract class DynamicContentEditControl : UserControl
Constructors
DynamicContentEditControl()
Declaration
protected DynamicContentEditControl()
Properties
Content
Provides you with the dynamic content the this settings is used for.
Declaration
[Obsolete("Use DynamicContent instead", false)]
public virtual IDynamicContent Content { get; set; }
Property Value
Type | Description |
---|---|
IDynamicContent | The dynamic content that this settings control is used for. |
Remarks
Any changes made to this object will be used when the markup for it is created. Use PrepareForSave() to update Content prior to save.
DynamicContent
Declaration
public virtual IDynamicContentBase DynamicContent { get; set; }
Property Value
Type | Description |
---|---|
IDynamicContentBase |
LocalizationService
The localizationService used by the various Translate methods
Declaration
protected virtual LocalizationService LocalizationService { get; set; }
Property Value
Type | Description |
---|---|
LocalizationService |
Remarks
Will return the static property Current if not set.
Methods
GetDynamicContentInstance<T>()
Gets the dynamic content instance.
Declaration
public virtual T GetDynamicContentInstance<T>()
where T : class
Returns
Type | Description |
---|---|
T | The class representing the dynamic content. |
Type Parameters
Name | Description |
---|---|
T | The requested implementing class. |
Remarks
This method is primarily used when you have a web control or a user control that uses the [DynamicContentPlugIn] attribute rather than implementing the IDynamicContent interface. This method will in the web control/user control case return the the control (which does not implement the IDynamicContent interface). This can then be used to update properties on the control that will be persisted as part of the dynamic content state.
In the case where the requested type directly implements the IDynamicContent interface, we will simply return the Content property.
PrepareForSave()
Is called when the ok-button on the dynamic content dialog is clicked. Override to add your own handling that needs to be done when the data is saved.
Declaration
public abstract void PrepareForSave()
Translate(String)
Translate the given string to the current language.
Declaration
public virtual string Translate(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | A string to translate |
Returns
Type | Description |
---|---|
System.String | The translated string. |
Remarks
GetStringByCulture(String, CultureInfo) for more information on the format of the string to translate.
TranslateFallback(String, String)
Translate the given string to the current language. Will return supplied fallback string if no match is found.
Declaration
public virtual string TranslateFallback(string key, string fallback)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | A string to translate |
System.String | fallback | The string to return if no match was found for key. |
Returns
Type | Description |
---|---|
System.String | The translated string. |
Remarks
GetStringByCulture(String, CultureInfo) for more information on the format of the string to translate.
TranslateForScript(String)
Translate the given string to the current language, in a script-safe format.
Declaration
public virtual string TranslateForScript(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | A string to translate |
Returns
Type | Description |
---|---|
System.String | The translated string. |
Remarks
GetStringByCulture(String, CultureInfo) for more information on the format of the string to translate.