Click or drag to resize
FormComponent Class
Represents a base class for a form component containing members used by the system. Do not inherit this class directly, inherit the FormComponentTProperties, TValue class instead.
Inheritance Hierarchy

Namespace: Kentico.Forms.Web.Mvc
Assembly: Kentico.Content.Web.Mvc (in Kentico.Content.Web.Mvc.dll) Version: 12.0.0
Syntax
C#
public abstract class FormComponent : IValidatableObject, 
	IModelMetadataModifier

The FormComponent type exposes the following members.

Constructors
  NameDescription
Protected methodFormComponent
Initializes a new instance of the FormComponent class for the specified properties type.
Top
Properties
  NameDescription
Public propertyBaseProperties
Gets the form component's properties as its base type.
Public propertyCustomAutopostHandling
If true, prevents built-in visibility condition handling for this component.
Public propertyDefinition
Gets or sets the definition under which the form component is registered in the system.
Public propertyHasDependingFields
Gets or sets a value indicating whether there are another form components whose visibility condition depends on this component's value.
Public propertyLabelForPropertyName
Gets the name of the property representing the editing field in the resulting HTML markup. The name is used to infer a proper label for attribute value in the rendered HTML markup. Defaults to first found property annotated with BindablePropertyAttribute.
Public propertyName
Gets or sets the name of the corresponding form field. The name is used as a prefix when naming the HTML input.
Public propertyPropertiesType
Gets the properties type of the form component.
Public propertyShowPartialValidationMessages
Also shows validation errors of partial values of the component. If false, each individual component should contain validation message in its partial view.
Top
Methods
  NameDescription
Public methodBindContext

Binds contextual information to the form component. The actual type of context depends on where the component is being used.

The component can throw an exception if being used in a context for which it is not designed. The base implementation provided by this class must be called prior to throwing an exception, however.

Public methodGetDisplayName
Returns non-localized string representing component name. Component Name is returned in case of empty Label.
Public methodGetModelPropertyCustomAttributesT
Gets a collection of custom attributes applied to the model's property this form component represents.
Public methodGetObjectValue
Gets the value of the form component.
Public methodLoadProperties
Loads properties of the form component. The actual properties type must match the PropertiesType.
Public methodModifyMetadata
Modifies modelMetadata according to the current object.
Public methodSetObjectValue
Sets the value of the form component. The value must be of proper type or an exception is thrown.
Public methodValidate
Determines whether the specified object is valid. Only invoked if validation by validation attributes passes for all fields.
Top
Extension Methods
  NameDescription
Public Extension MethodGetBizFormComponentContext
Gets BizFormComponentContext of a form component, if such a context was bound to the component.
(Defined by FormComponentExtensions.)
Top
Remarks
Properties which are expected to have automatically bound values after form submit, have to be annotated with BindablePropertyAttribute. Implements the IValidatableObject to support custom validation.
See Also