Class XFormControl
The main class for a XForm.
Inheritance
Implements
Namespace: EPiServer.XForms.WebControls
Assembly: EPiServer.XForms.dll
Version: 8.11.0Syntax
public class XFormControl : Control, INamingContainer
Constructors
XFormControl()
Initializes a new instance of the XFormControl class.
Declaration
public XFormControl()
Properties
Data
A reference to the XFormData that the form is submitted to.
Declaration
public XFormData Data { get; set; }
Property Value
Type | Description |
---|---|
XFormData |
Remarks
If not set FormDefinition.CreateFormData() will be called to create a new XFormData for the form. If this property has been set when the controls are rendered the values from the form data will be loaded.
EditMode
Used to determine if controls should render themselves in edit mode.
Declaration
public bool EditMode { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableClientScript
Gets or sets a value indicating whether client validation scripts are enabled.
Declaration
public bool EnableClientScript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
FormDefinition
The definition for the form.
Declaration
public XForm FormDefinition { get; set; }
Property Value
Type | Description |
---|---|
XForm |
FormID
The id of the XForm.
Declaration
public int FormID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ValidationGroup
Gets or sets the validation group.
Declaration
public string ValidationGroup { get; set; }
Property Value
Type | Description |
---|---|
System.String | The validation group. Default is String.Empty |
Methods
AddParsedSubObject(Object)
Declaration
protected override void AddParsedSubObject(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
ClearEventHandlers()
Clears all events from the event handlers.
Declaration
public void ClearEventHandlers()
CreateChildControls()
Declaration
protected override void CreateChildControls()
DataBind()
Creates the child controls from the XForm representation.
Declaration
public override void DataBind()
ExtractXFormControls()
Extracts all the xform input controls from the form.
Declaration
public List<XFormControlBase> ExtractXFormControls()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<XFormControlBase> | An ArrayList containing all xform controls |
Remarks
Submit controls are also returned. This method has to be called after the ControlsCreated event.
FindControl(String)
Declaration
public override Control FindControl(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id |
Returns
Type | Description |
---|---|
System.Web.UI.Control |
SubmitForm(ChannelOptions)
Declaration
public void SubmitForm(ChannelOptions options)
Parameters
Type | Name | Description |
---|---|---|
ChannelOptions | options |
Events
AfterSubmitPostedData
EventHandler that is triggered after the control has validated and sent it's data.
Declaration
public event SaveFormDataEventHandler AfterSubmitPostedData
Event Type
Type | Description |
---|---|
SaveFormDataEventHandler |
BeforeLoadingForm
This event is triggered when loading the form before the form controls are parsed.
Declaration
public event LoadFormEventHandler BeforeLoadingForm
Event Type
Type | Description |
---|---|
LoadFormEventHandler |
BeforeSubmitPostedData
EventHandler that is called after the values have been read and validated but before the form is submitted. This is the last chance to stop the form from being submitted.
Declaration
public event SaveFormDataEventHandler BeforeSubmitPostedData
Event Type
Type | Description |
---|---|
SaveFormDataEventHandler |
Remarks
This event will be triggered even if the posted data is not valid. If you want to add logic when posting data you might want to check if the page is valid (see System.Web.UI.Page.IsValid).
ControlsCreated
Occurs when the child controls has been created.
Declaration
public event EventHandler ControlsCreated
Event Type
Type | Description |
---|---|
System.EventHandler |
ControlSetup
Static event that is triggered every time a XFormControl is created.
Declaration
public static event EventHandler ControlSetup
Event Type
Type | Description |
---|---|
System.EventHandler |
Remarks
This event can be used to attach to other events for the control where you do not have access to the actual control. This can for instance be the case when a form is loaded through dynamic content.