Class PropertyDataControl
Base class used to create a user interface for PropertyData objects.
Inheritance
Namespace: EPiServer.Web.PropertyControls
Assembly: EPiServer.dll
Version: 10.10.4Syntax
public abstract class PropertyDataControl : WebControl, IPropertyControl, INamingContainer, IRenderSettings
Constructors
PropertyDataControl()
Initializes a new instance of the PropertyDataControl class.
Declaration
protected PropertyDataControl()
Properties
AttributeSourceControl
A WebControl that will be used to copy values from when copying attributes to WebControls for a PropertyControl.
Declaration
public WebControl AttributeSourceControl { get; set; }
Property Value
Type | Description |
---|---|
System.Web.UI.WebControls.WebControl |
Remarks
EPiServer.Web.WebControls.Property set this property to itself to be able to act as source for attributes. This makes it possible to set for instance CssClass on a property and the value will be copied to the WebControl created for a PropertyControl.
ContentSource
Gets the nearest parent that implements IContentSource.
Declaration
public IContentSource ContentSource { get; }
Property Value
Type | Description |
---|---|
IContentSource |
CurrentContent
Gets the current content object from the nearest parent that implements IContentSource.
Declaration
public IContent CurrentContent { get; }
Property Value
Type | Description |
---|---|
IContent | The content of the current. |
CurrentPage
Gets the current PageData object from the nearest parent that implements IPageSource.
Declaration
public PageData CurrentPage { get; }
Property Value
Type | Description |
---|---|
PageData | The current PageData object. |
CustomTagName
Gets or sets the tag name. If not set a span-tag will be used.
Declaration
public string CustomTagName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The custom tag name. |
Examples
Set to "h1" to create a h1-tag around the content.
DisplayEditUI
Gets a value indicating whether the control should display an edit user interface.
Declaration
public virtual bool DisplayEditUI { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If the control has a adapter that implements IPropertyControl the adapters value will be returned.
EditorSettings
Gets or sets the editor settings.
Declaration
public IDictionary<string, object> EditorSettings { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | The editor settings. |
IsNull
Gets a value indicating whether the property is null.
Declaration
public bool IsNull { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsRequired
Gets a value indicating whether the property is required.
Declaration
protected bool IsRequired { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Name
Gets the name of the property.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String | The name of the property. |
ObjectSerializerFactory
Gets or sets the object serializer to use when serializing to Json.
Declaration
protected Injected<IObjectSerializerFactory> ObjectSerializerFactory { get; set; }
Property Value
Type | Description |
---|---|
Injected<IObjectSerializerFactory> | The object serializer. |
OverlaySettings
Gets or sets the overlay settings.
Declaration
public IDictionary<string, object> OverlaySettings { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | The overlay settings. |
PageSource
Gets the nearest parent that implements IPageSource.
Declaration
public IPageSource PageSource { get; }
Property Value
Type | Description |
---|---|
IPageSource | The nearest parent that implements IPageSource. |
Properties
Sets the properties that are being edited for the IPropertyControl.
Declaration
public PropertyDataCollection Properties { get; set; }
Property Value
Type | Description |
---|---|
PropertyDataCollection |
Remarks
Properties is only set when editing multiple properties.
PropertyData
Gets or sets the PropertyData for the IPropertyControl.
Declaration
public PropertyData PropertyData { get; set; }
Property Value
Type | Description |
---|---|
PropertyData | The PropertyData that is to be displayed or edited. |
RenderSettings
Dictionary of key values that can be used to customize the rendering of the property. These settings will also be passed to the property editor.
Declaration
public IDictionary<string, object> RenderSettings { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | The render settings. |
RenderType
Sets the RenderType for the IPropertyControl.
Declaration
public RenderType RenderType { get; set; }
Property Value
Type | Description |
---|---|
RenderType | A RenderType that is used to specify how the PropertyDataControl should be rendered. |
RequiredFieldCssClass
Gets or sets the CSS class that will be used to indicate a required field.
Declaration
public string RequiredFieldCssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | The CSS class that will be used to indicate a required field. |
RowLayout
Specifies how a property row is rendered in the edit user interface.
Declaration
public virtual TableRowLayout RowLayout { get; }
Property Value
Type | Description |
---|---|
TableRowLayout | One of the values defined in TableRowLayout. |
Remarks
If the control has a adapter that implements IPropertyControl the adapters value will be returned.
SupportsOnPageEdit
Gets a value indicating whether this control supports "on page edit".
Declaration
public virtual bool SupportsOnPageEdit { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If this property returns false CreateDefaultControls() will be called instead of CreateOnPageEditControls() when in "on page edit" mode.
ValidationGroup
Gets or sets the validation group.
Declaration
public string ValidationGroup { get; set; }
Property Value
Type | Description |
---|---|
System.String | The validation group. |
Remarks
This is only valid for web form based editors.
Methods
AddErrorValidator(String)
Adds an error validator to the control collection and to the Page.Validators collection.
Declaration
public virtual void AddErrorValidator(string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
System.String | errorMessage | The error message. |
Remarks
This method is used to indicate that invalid data has been entered by the user.
ApplyChanges()
Applies changes for the posted data to the page's properties.
Declaration
public virtual void ApplyChanges()
Remarks
If this control has an adapter that implements IPropertyControl the adapers ApplyChanges() method will be called.
ApplyControlAttributes(WebControl)
Copies web attribues and style information. Also sets a css class indicating if this property is required if RenderType is set to Edit.
Declaration
public virtual void ApplyControlAttributes(WebControl control)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.WebControls.WebControl | control | The control to setup. |
ApplyEditAttributes()
Applies the required data attributes to the first control to make the property editable.
Declaration
public void ApplyEditAttributes()
ApplyEditChanges()
Applies changes for the posted data to the page's properties when the RenderType property is set to Edit.
Declaration
public virtual void ApplyEditChanges()
Remarks
This method is called from ApplyChanges() if the control does not have an adapter.
ApplyRequiredCssClass(WebControl)
Applies a CSS class indicating that the input control is required.
Declaration
protected virtual void ApplyRequiredCssClass(WebControl input)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.WebControls.WebControl | input | The input control. |
CopyWebAttributes(HtmlControl)
Copies render attributes from a WebControl defined in the property AttributeSourceControl. If this property is not set the attributes will be copied from the Control itself.
Declaration
public virtual void CopyWebAttributes(HtmlControl target)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.HtmlControls.HtmlControl | target | The control to copy attributes to. |
Remarks
This can be used for custom web controls to make them support standard rendering properties without having to explicitly implement code to handle those attributes.
CopyWebAttributes(WebControl)
Copies render attributes from a WebControl defined in the property AttributeSourceControl. If this property is not set the attributes will be copied from the Control itself.
Declaration
public virtual void CopyWebAttributes(WebControl target)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.WebControls.WebControl | target | The control to copy attributes to. |
Remarks
This can be used for custom web controls to make them support standard rendering properties without having to explicitly implement code to handle those attributes.
CreateChildControls()
Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
Declaration
protected override void CreateChildControls()
CreateDefaultControls()
Creates the default controls for the property. Used when the property is in view mode or in "on page edit" mode and the PropertyDataControl does not support on page editing.
Declaration
public virtual void CreateDefaultControls()
CreateEditControls()
Creates an edit interface for the property.
Declaration
public virtual void CreateEditControls()
CreateErrorValidator(String)
Creates an static validator for an error message.
Declaration
protected StaticValidator CreateErrorValidator(string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
System.String | errorMessage | The error message. |
Returns
Type | Description |
---|---|
StaticValidator | A static validator |
Remarks
This method is used to indicate that invalid data has been entered by the user.
CreateOnPageEditControls()
Creates the "on page edit" controls.
Declaration
public virtual void CreateOnPageEditControls()
FindParentControl<T>(Control)
Finds the parent content control.
Declaration
protected static T FindParentControl<T>(Control control)
where T : class
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.Control | control | The control. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
OnPreRender(EventArgs)
Raises the System.Web.UI.Control.PreRender event.
Declaration
protected override void OnPreRender(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs object that contains the event data. |
PropertyIsEditableForCurrentLanguage()
Determines if the property is editable in the current language
Declaration
public bool PropertyIsEditableForCurrentLanguage()
Returns
Type | Description |
---|---|
System.Boolean | True if editable, false otherwise |
RenderBeginTag(HtmlTextWriter)
Renders the HTML opening tag of the control to the specified writer. This method is used primarily by control developers.
Declaration
public override void RenderBeginTag(HtmlTextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.HtmlTextWriter | writer | A System.Web.UI.HtmlTextWriter that represents the output stream to render HTML content on the client. |
Remarks
PropertyDataControl does not render any tags itself
RenderEndTag(HtmlTextWriter)
Renders the HTML closing tag of the control into the specified writer. This method is used primarily by control developers.
Declaration
public override void RenderEndTag(HtmlTextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.HtmlTextWriter | writer | A System.Web.UI.HtmlTextWriter that represents the output stream to render HTML content on the client. |
Remarks
PropertyDataControl does not render any tags itself
SetEnableStateForChildControls(Control, Boolean)
Used to enable or disable input controls for any child controls.
Declaration
protected virtual void SetEnableStateForChildControls(Control control, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.Control | control | The control. |
System.Boolean | enabled | If the child controls should be enabled or disabled. |
SetupControl()
Called when setting up the properties for a page.
Declaration
public virtual void SetupControl()
Remarks
If the control creates it's child controls in CreateChildControls(), EnsureChildControls() should be called in this method to make sure the child controls are created before loading post data.
SetupEditControls()
Used to apply a custom setup to the edit controls.
Declaration
protected virtual void SetupEditControls()
Remarks
This method is called from CreateEditControls after the edit control(s) have been created.
SetValue(Object)
Sets a given value to the current PropertyData object.
Declaration
public void SetValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to be set. |
SetValue(Object, PropertyData)
Sets a given value to the current PropertyData object.
Declaration
public void SetValue(object value, PropertyData property)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to be set. |
PropertyData | property | The property that should have the value. |
ShouldCreateDefaultControls()
If CreateDefaultControls() should be called.
Declaration
protected virtual bool ShouldCreateDefaultControls()
Returns
Type | Description |
---|---|
System.Boolean | True if CreateDefaultControls() should be called. |
Remarks
Default implementation checks the IsNull property on PropertyData.
ToJson(Object)
Declaration
protected string ToJson(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type | Description |
---|---|
System.String |
ToString()
Returns a string representation of the property's value..
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representation of the property's value.. |
ToWebString()
Get the web string representation of the property's value, on properties that do not use the editor this string will usually not contain any markup characters.
Declaration
public virtual string ToWebString()
Returns
Type | Description |
---|---|
System.String |
TranslateDisplayName()
Gets the translated display name of the property.
Declaration
public string TranslateDisplayName()
Returns
Type | Description |
---|---|
System.String | The translated display name of the property. |