November Happy Hour will be moved to Thursday December 5th.

Class PropertySettingsUIAttribute

Attibute to specify a settings UI for a PropertySettingsAttribute marked class.

Inheritance
System.Object
System.Attribute
PropertySettingsUIAttribute
Implements
System.Runtime.InteropServices._Attribute
Inherited Members
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.Equals(System.Object)
System.Attribute.GetHashCode()
System.Attribute.Match(System.Object)
System.Attribute.IsDefaultAttribute()
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfoCount(System.UInt32)
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Attribute.TypeId
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core.PropertySettings
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
public class PropertySettingsUIAttribute : Attribute, _Attribute
Remarks

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

true if an attribute was found.

Implements

System.Runtime.InteropServices._Attribute

Extension Methods