DataWeb
Search Results for

    Show / Hide Table of Contents

    Class Control

    An abstract base class for controls that can be used on a form.

    Inheritance
    object
    Control
    ActionList
    AutoComplete
    AutoCompleteList
    CheckBoxList
    ColorPicker
    CultureEditor
    CustomControl
    DataEditor
    DateTimePicker
    DropDownList
    FileDownload
    FileRender
    FileUpload
    Label
    ListBox
    ListEditor
    NewsletterMailingList_MailingListPreview
    NewsletterModel_NewsletterPreview
    NewsletterModel_NewsletterSender
    NewsletterRow_NewsletterReport
    NewsletterSubscriber_TermsInfo
    Note
    RadioButtonList
    Slug
    TagEditor
    TextArea
    TextBox
    TextEditor
    TextEditorClassic
    Title
    User_AccountEditor
    User_AccountNewsletter
    User_TermsInfo
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Data
    Assembly: DataWeb.Core.dll
    Syntax
    public abstract class Control
    Remarks

    Initializes a new instance of the Control class with the specified form and service provider.

    Constructors

    Control(Form, IServiceProvider)

    An abstract base class for controls that can be used on a form.

    Declaration
    protected Control(Form form, IServiceProvider serviceProvider)
    Parameters
    Type Name Description
    Form form

    The form that the control belongs to.

    IServiceProvider serviceProvider

    The service provider used to resolve dependencies.

    Remarks

    Initializes a new instance of the Control class with the specified form and service provider.

    Fields

    form

    Declaration
    protected readonly Form form
    Field Value
    Type Description
    Form

    serviceProvider

    Declaration
    protected readonly IServiceProvider serviceProvider
    Field Value
    Type Description
    IServiceProvider

    Properties

    Actions

    Gets or sets the list of actions associated with the control.

    Declaration
    public List<ContextAction> Actions { get; set; }
    Property Value
    Type Description
    List<ContextAction>

    ControlClass

    Gets or sets the CSS class for the control.

    Declaration
    public string ControlClass { get; set; }
    Property Value
    Type Description
    string

    CustomControlComponent

    Gets or sets the name of the custom control component.

    Declaration
    public string CustomControlComponent { get; set; }
    Property Value
    Type Description
    string

    CustomControlOptions

    Gets or sets the options for the custom control.

    Declaration
    public object CustomControlOptions { get; set; }
    Property Value
    Type Description
    object

    DataField

    Gets or sets the name of the data field that the control is bound to.

    Declaration
    public string DataField { get; set; }
    Property Value
    Type Description
    string

    DataSource

    Gets or sets the name of the data source that the control uses.

    Declaration
    public string DataSource { get; set; }
    Property Value
    Type Description
    string

    DataSourceMode

    Gets or sets the mode of the data source that the control uses.

    Declaration
    public string DataSourceMode { get; set; }
    Property Value
    Type Description
    string

    DataSubField

    Gets or sets the name of the subfield of the data field that the control is bound to.

    Declaration
    public string DataSubField { get; set; }
    Property Value
    Type Description
    string

    DataType

    Gets or sets the data type of the data field that the control is bound to.

    Declaration
    public string DataType { get; set; }
    Property Value
    Type Description
    string

    DefaultValue

    Gets or sets the default value of the control.

    Declaration
    public string DefaultValue { get; set; }
    Property Value
    Type Description
    string

    DefaultValueMode

    Gets or sets the mode of the default value of the control.

    Declaration
    public string DefaultValueMode { get; set; }
    Property Value
    Type Description
    string

    Events

    Gets or sets the list of events associated with the control.

    Declaration
    public List<Control.Event> Events { get; set; }
    Property Value
    Type Description
    List<Control.Event>

    FileMaxCount

    Gets or sets the maximum number of files that can be uploaded through the file input control.

    Declaration
    public int? FileMaxCount { get; set; }
    Property Value
    Type Description
    int?

    FileMaxSize

    Gets or sets the maximum size of the file that can be uploaded through the file input control.

    Declaration
    public long? FileMaxSize { get; set; }
    Property Value
    Type Description
    long?

    FileTagName

    Gets or sets the name of the file input control.

    Declaration
    public string FileTagName { get; set; }
    Property Value
    Type Description
    string

    FileTypes

    Gets or sets the list of file types that the file input control accepts.

    Declaration
    public List<string> FileTypes { get; set; }
    Property Value
    Type Description
    List<string>

    FormName

    Gets or sets the name of the form that the control belongs to.

    Declaration
    public string FormName { get; set; }
    Property Value
    Type Description
    string

    Group

    Gets or sets the group that the control belongs to.

    Declaration
    public string Group { get; set; }
    Property Value
    Type Description
    string

    IsLateDataBinding

    Gets or sets a value indicating whether the data binding is done at a later time.

    Declaration
    public bool IsLateDataBinding { get; set; }
    Property Value
    Type Description
    bool

    IsLocalization

    Gets or sets a value indicating whether the control supports localization.

    Declaration
    public bool IsLocalization { get; set; }
    Property Value
    Type Description
    bool

    IsReadOnly

    Gets or sets a value indicating whether the control is read-only.

    Declaration
    public bool IsReadOnly { get; set; }
    Property Value
    Type Description
    bool

    IsRequired

    Gets or sets a value indicating whether the control is required.

    Declaration
    public bool IsRequired { get; set; }
    Property Value
    Type Description
    bool

    IsVersionLinked

    Gets or sets a value indicating whether the control is linked to a version.

    Declaration
    public bool IsVersionLinked { get; set; }
    Property Value
    Type Description
    bool

    IsVisible

    Gets or sets a value indicating whether the control is visible.

    Declaration
    public bool IsVisible { get; set; }
    Property Value
    Type Description
    bool

    IsVisibleRoles

    Gets or sets a value indicating whether the control is visible to certain roles.

    Declaration
    public bool IsVisibleRoles { get; set; }
    Property Value
    Type Description
    bool

    ListControlNames

    Gets or sets a comma-separated list of the names of the controls in the list.

    Declaration
    public string ListControlNames { get; set; }
    Property Value
    Type Description
    string

    MaxLength

    Gets or sets the maximum length of the control value.

    Declaration
    public int? MaxLength { get; set; }
    Property Value
    Type Description
    int?

    Name

    Gets or sets the name of the control.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string

    RegularExpression

    Gets or sets the regular expression that the control value should match.

    Declaration
    public string RegularExpression { get; set; }
    Property Value
    Type Description
    string

    StylePath

    Gets or sets the path to the style sheet for the control.

    Declaration
    public string StylePath { get; set; }
    Property Value
    Type Description
    string

    Title

    Gets or sets the title of the control.

    Declaration
    public string Title { get; set; }
    Property Value
    Type Description
    string

    Type

    Gets or sets the type of the control.

    Declaration
    public string Type { get; set; }
    Property Value
    Type Description
    string

    VisibleRoles

    Gets or sets the list of roles that the control is visible to.

    Declaration
    public List<string> VisibleRoles { get; set; }
    Property Value
    Type Description
    List<string>

    Methods

    AddActionSetLocalAction(string, string, ContextActionType)

    Adds an action to set a local action for the control.

    Declaration
    public void AddActionSetLocalAction(string title, string name, ContextActionType type)
    Parameters
    Type Name Description
    string title

    The title of the action.

    string name

    The name of the local action.

    ContextActionType type

    The ContextActionType of the action.

    AddActionSetNavigation(string, Step, List<Step>)

    Adds a "Set Navigation" action to the control's list of actions.

    Declaration
    public void AddActionSetNavigation(string title, ContextAction.Step currentStep, List<ContextAction.Step> newSteps)
    Parameters
    Type Name Description
    string title

    The title of the action.

    ContextAction.Step currentStep

    The current ContextAction.Step in the navigation context.

    List<ContextAction.Step> newSteps

    The new ContextAction.Step objects to be added to the navigation context.

    AddActionSetNavigation(string, List<Step>)

    Adds a "Set Navigation" action to the control's list of actions.

    Declaration
    public void AddActionSetNavigation(string title, List<ContextAction.Step> newSteps)
    Parameters
    Type Name Description
    string title

    The title of the action.

    List<ContextAction.Step> newSteps

    The new ContextAction.Step objects to be added to the navigation context.

    AddActionSetRemoteAction(string, string, ContextActionType, string, bool, bool, bool)

    Adds an action to set a remote action for the control.

    Declaration
    public void AddActionSetRemoteAction(string title, string name, ContextActionType type, string dialogFormName = null, bool isConfirmRequired = false, bool isSaveItemBeforeProcess = false, bool isReloadAfterProcess = false)
    Parameters
    Type Name Description
    string title

    The title of the action.

    string name

    The name of the remote action.

    ContextActionType type

    The ContextActionType of the action.

    string dialogFormName
    bool isConfirmRequired
    bool isSaveItemBeforeProcess
    bool isReloadAfterProcess

    AddActionUpdateData()

    Adds an "Update Data" action to the control's list of actions.

    Declaration
    public void AddActionUpdateData()

    AddEventSetDataSourceParameter(List<string>, List<string>)

    Adds an event to set the data source parameter of the control based on the specified reference and target names.

    Declaration
    public void AddEventSetDataSourceParameter(List<string> referenceNames, List<string> targetNames)
    Parameters
    Type Name Description
    List<string> referenceNames

    The reference names for the event.

    List<string> targetNames

    The target names for the event.

    AddEventSetIsRequired(EventCondition, List<string>, List<string>)

    Adds an event to set the required state of the control based on the specified condition and reference values.

    Declaration
    public void AddEventSetIsRequired(EventCondition condition, List<string> referenceValues, List<string> targetNames)
    Parameters
    Type Name Description
    EventCondition condition

    The EventCondition for the event.

    List<string> referenceValues

    The reference values for the event.

    List<string> targetNames

    The target names for the event.

    AddEventSetIsVisible(EventCondition, List<string>, List<string>, bool)

    Adds an event to set the visibility of the control based on the specified condition and reference values.

    Declaration
    public void AddEventSetIsVisible(EventCondition condition, List<string> referenceValues, List<string> targetNames, bool isKeepValueOnHidden = true)
    Parameters
    Type Name Description
    EventCondition condition

    The EventCondition for the event.

    List<string> referenceValues

    The reference values for the event.

    List<string> targetNames

    The target names for the event.

    bool isKeepValueOnHidden

    A value indicating whether to keep the control value when it is hidden.

    GetControlDefaultValue()

    Gets the default value for this control.

    Declaration
    public object GetControlDefaultValue()
    Returns
    Type Description
    object

    The default value for this control.

    GetDefaultValueAsync(IUser, string, NavigationContext, CancellationToken)

    Gets the default value for the control asynchronously.

    Declaration
    public virtual Task<object> GetDefaultValueAsync(IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IUser user

    The IUser for whom to get the default value.

    string itemId

    The Id of the item to which the default value is associated, if applicable.

    NavigationContext navigationContext

    The NavigationContext, if applicable.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<object>

    A task that represents the asynchronous operation and returns the default value for the control.

    GetListValuesAsync(Dictionary<string, object>, IUser, string, NavigationContext, CancellationToken)

    Gets the list values for the control asynchronously.

    Declaration
    public virtual Task<IEnumerable<List.ListItem>> GetListValuesAsync(Dictionary<string, object> parameters, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Dictionary<string, object> parameters

    The parameters used to retrieve the list values.

    IUser user

    The IUser for whom to retrieve the list values.

    string itemId

    The Id of the item to which the list values are associated, if applicable.

    NavigationContext navigationContext

    The NavigationContext, if applicable.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<List.ListItem>>

    A task that represents the asynchronous operation and returns the list values for the control.

    InitAsync(CancellationToken)

    Initializes the control asynchronously.

    Declaration
    public virtual Task InitAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task that represents the asynchronous initialization operation.

    IsUpdateDataAsync(object, List<ProvidedValue>, Dictionary<string, object>, IUser, string, NavigationContext, CancellationToken)

    Determines whether data is updated on this control.

    Declaration
    public virtual Task<bool> IsUpdateDataAsync(object value, List<Form.ProvidedValue> providedValues, Dictionary<string, object> sectionData, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    object value

    The value of the control.

    List<Form.ProvidedValue> providedValues

    A list of values provided for other controls on the form.

    Dictionary<string, object> sectionData

    The section data of the form.

    IUser user

    The IUser saving the form.

    string itemId

    The Id of the item being edited (null if adding new).

    NavigationContext navigationContext

    The NavigationContext of the form.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>

    True if data is updated on this control, otherwise false.

    ProcessActionAsync(ContextAction, IUser, string, object, List<ProvidedValue>, NavigationContext, CancellationToken)

    Processes action on this control.

    Declaration
    public virtual Task<ContextAction.Result> ProcessActionAsync(ContextAction action, IUser user, string itemId = null, object value = null, List<Form.ProvidedValue> controlValues = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ContextAction action

    The action to perform.

    IUser user

    The IUser performing the action.

    string itemId

    The Id of the item being edited (null if adding new).

    object value
    List<Form.ProvidedValue> controlValues
    NavigationContext navigationContext

    The NavigationContext of the form.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ContextAction.Result>

    The result of the action.

    ProcessOnGetValueAsync(object, Dictionary<string, object>, IUser, string, NavigationContext, CancellationToken)

    Processes the control value asynchronously.

    Declaration
    public virtual Task<object> ProcessOnGetValueAsync(object value, Dictionary<string, object> sectionData, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    object value

    The value to process.

    Dictionary<string, object> sectionData

    The section data.

    IUser user

    The IUser for whom to process the value.

    string itemId

    The Id of the item to which the value is associated, if applicable.

    NavigationContext navigationContext

    The NavigationContext, if applicable.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<object>

    A task that represents the asynchronous operation and returns the processed value.

    ProcessOnSaveDataAsync(object, List<ProvidedValue>, Dictionary<string, object>, IUser, string, NavigationContext, CancellationToken)

    Sanitizes the control value before saving it.

    Declaration
    public virtual Task<object> ProcessOnSaveDataAsync(object value, List<Form.ProvidedValue> providedValues, Dictionary<string, object> sectionData, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    object value

    The value of the control to sanitize.

    List<Form.ProvidedValue> providedValues

    A list of values provided for other controls on the form.

    Dictionary<string, object> sectionData

    The section data of the form.

    IUser user

    The IUser saving the form.

    string itemId

    The Id of the item being edited (null if adding new).

    NavigationContext navigationContext

    The NavigationContext of the form.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<object>

    The sanitized value of the control.

    ProcessOnTranslateAsync(object, Dictionary<string, string>, Dictionary<string, object>, string, string, IUser, string, NavigationContext, CancellationToken)

    Processes the control value on translation.

    Declaration
    public virtual Task<object> ProcessOnTranslateAsync(object value, Dictionary<string, string> translatedValues, Dictionary<string, object> sectionData, string culture, string sourceCulture, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    object value

    The value to process.

    Dictionary<string, string> translatedValues

    The translated values.

    Dictionary<string, object> sectionData

    The section data.

    string culture

    The culture to process.

    string sourceCulture

    The source culture.

    IUser user

    The IUser for whom to process the value.

    string itemId

    The Id of the item to which the value is associated, if applicable.

    NavigationContext navigationContext

    The NavigationContext, if applicable.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<object>

    A task that represents the asynchronous operation and returns the processed value.

    SanitizeControlValue(object)

    Sanitizes the control value by stripping any HTML tags if the control data type is "String".

    Declaration
    public object SanitizeControlValue(object value)
    Parameters
    Type Name Description
    object value

    The control value.

    Returns
    Type Description
    object

    The sanitized control value.

    ValidateAsync(object, List<ProvidedValue>, Dictionary<string, object>, IUser, string, NavigationContext, CancellationToken)

    Validates the control asynchronously.

    Declaration
    public virtual Task<List<ValidationError>> ValidateAsync(object value, List<Form.ProvidedValue> providedValues, Dictionary<string, object> sectionData, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    object value

    The value of the control to validate.

    List<Form.ProvidedValue> providedValues

    The provided Form.ProvidedValue values.

    Dictionary<string, object> sectionData

    The section data.

    IUser user

    The IUser that is requesting the validation.

    string itemId

    The Id of the item that the control is associated with.

    NavigationContext navigationContext

    The NavigationContext of the form.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<List<ValidationError>>

    The validation errors, if any.

    ValidateControlDataType(object)

    Validates whether the value of a control matches its data type.

    Declaration
    public List<ValidationError> ValidateControlDataType(object value)
    Parameters
    Type Name Description
    object value

    The value of the control.

    Returns
    Type Description
    List<ValidationError>

    A list of validation errors.

    ValidateControlIsRequired(object)

    Validates whether a control is required.

    Declaration
    public List<ValidationError> ValidateControlIsRequired(object value)
    Parameters
    Type Name Description
    object value

    The value of the control.

    Returns
    Type Description
    List<ValidationError>

    A list of validation errors.

    Extension Methods

    FormMapperExtension.ToControlInfo(Control, Dictionary<string, object>, Dictionary<string, object>)
    In this article
    Back to top Generated by DocFX