Table of Contents

Class SelectorFormComponent<TProperties>

Namespace
Kentico.Forms.Web.Mvc
Assembly
Kentico.Content.Web.Mvc.dll

Provides basic component support for selectors.

public abstract class SelectorFormComponent<TProperties> : FormComponent<TProperties, string> where TProperties : SelectorProperties, new()

Type Parameters

TProperties

Properties type of the form component.

Inheritance
object
FormComponent<TProperties, string>
SelectorFormComponent<TProperties>
Derived
Inherited Members
Extension Methods

Remarks

Selected value is of string type.

Properties

HtmlOptions

Gets the collection of items populated in component.

public IEnumerable<HtmlOptionItem> HtmlOptions { get; }

Property Value

IEnumerable<HtmlOptionItem>

LabelForPropertyName

Gets name of the SelectedValue property.

public override string LabelForPropertyName { get; }

Property Value

string

SelectedValue

Gets or sets value selected by component.

public virtual string SelectedValue { get; set; }

Property Value

string

Methods

GetHtmlOptions()

Returns collection of items populated in component.

protected virtual IEnumerable<HtmlOptionItem> GetHtmlOptions()

Returns

IEnumerable<HtmlOptionItem>

GetValue()

Gets the SelectedValue property.

public override string GetValue()

Returns

string

LoadProperties(FormComponentProperties)

Loads properties of the form component. The actual properties type must match the PropertiesType.

public override void LoadProperties(FormComponentProperties properties)

Parameters

properties FormComponentProperties

Form component properties to be loaded.

Exceptions

ArgumentNullException

Thrown when properties are null.

ArgumentException

Thrown when properties do not match the PropertiesType.

SetValue(string)

Sets the SelectedValue property.

public override void SetValue(string value)

Parameters

value string

Validate(ValidationContext)

Performs validation on SelectedValue property checking whether such value is present in HtmlOptions.

public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)

Parameters

validationContext ValidationContext

The validation context.

Returns

IEnumerable<ValidationResult>

Collection holding validation results.