Class PropertySettingsUIAttribute
Attibute to specify a settings UI for a PropertySettingsAttribute marked class.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Core.PropertySettings
Assembly: EPiServer.dll
Version: 10.10.4Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
public class PropertySettingsUIAttribute : Attribute, _AttributeRemarks
Use this attibute to specify which UI control a class or property should use in admin mode. The control specified also needs to implement the IPropertySettingsUI interface.
Examples
  Simple example of marking a settings class with a UI.
    /// <summary>
/// Used to render a UI for editing the settings in the admin UI.
/// Needs to be in the inherit from <see cref="Control"/> and implement <see cref="IPropertySettingsUI"/>.
/// Most easily accomplished using <see cref="PropertySettingsUIBase"/>
/// </summary>
public class SettingsUISample : PropertySettingsControlBase
{
private TextBox _widthInput;
#region IPropertySettingsUI Members
protected override void CreateChildControls()
{
base.CreateChildControls();
_widthInput = new TextBox { ID = "WidthValue" };
Label label = new Label { Text = "Width", AssociatedControlID = "WidthValue" };
Controls.Add(label);
Controls.Add(_widthInput);
}
public override void LoadSettingsUI(IPropertySettings propertySettings)
{
EnsureChildControls();
_widthInput.Text = ((SamplePropertySettings)propertySettings).Width.ToString();
}
public override void UpdateSettings(IPropertySettings propertySettings)
{
EnsureChildControls();
((SamplePropertySettings)propertySettings).Width = int.Parse(_widthInput.Text);
}
#endregion
}Constructors
PropertySettingsUIAttribute()
Initializes a new instance of the PropertySettingsUIAttribute class.
Declaration
public PropertySettingsUIAttribute()PropertySettingsUIAttribute(Type)
Initializes a new instance of the PropertySettingsUIAttribute class.
Declaration
public PropertySettingsUIAttribute(Type type)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | type | The type. | 
PropertySettingsUIAttribute(Type, String)
Initializes a new instance of the PropertySettingsUIAttribute class.
Declaration
public PropertySettingsUIAttribute(Type type, string controlValue)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | type | The type. | 
| System.String | controlValue | The control value to use to set and get the settings value. | 
Properties
AdminControl
Gets or sets the admin control.
Declaration
public Type AdminControl { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Type | The admin control. | 
AdminControlValue
Gets or sets the name of the admin control property that is used to get and set the settings object.
Declaration
public string AdminControlValue { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | The property name of the admin control that holds the value. | 
Remarks
For a System.Web.UI.WebControls.TextBox this should be set to "Text".
Url
The url to the user control.
Declaration
public string Url { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | 
UrlFromUi
Gets and sets the url to the user control relative the UI folder.
Declaration
public string UrlFromUi { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | The URL relative the UI folder. | 
UrlFromUtil
Gets or sets the URL to the user control relative the util folder.
Declaration
public string UrlFromUtil { get; set; }Property Value
| Type | Description | 
|---|---|
| System.String | The URL relative the util folder. | 
Methods
LoadAdminControl(Page)
Loads the admin control.
Declaration
public IPropertySettingsUI LoadAdminControl(Page page)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Web.UI.Page | page | The page that the control should be added to. | 
Returns
| Type | Description | 
|---|---|
| IPropertySettingsUI | If the url to a user control has been set this is loaded, otherwise a new instance of the control specified in AdminControl is loaded. | 
TryGetAttribute(Type, out PropertySettingsUIAttribute)
Tries to get a PropertySettingsUIAttribute from a type.
Declaration
public static bool TryGetAttribute(Type type, out PropertySettingsUIAttribute attribute)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | type | The type. | 
| PropertySettingsUIAttribute | attribute | The attribute to set if succesfull. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
 | 
