ASPxClientEdit.ClearEditorsInContainer(container) Method

Assigns a null value to all editors in a specified visibility state, which are located within a specified container and belong to a specific validation group.

Declaration

static ClearEditorsInContainer(container: any, validationGroup?: string, clearInvisibleEditors?: boolean): void

Parameters

Name Type Description
container any

An HTML element specifying the container of editors to be validated.

Optional Parameters

Name Type Default Description
validationGroup string null

A string value specifying the validation group's name.

clearInvisibleEditors boolean null

true to clear both visible and invisible editors that belong to the specified container and group; false to clear only visible editors.

Remarks

Call this method to programmatically clear the editors while performing client-side validation, based on specified settings.

Note

If the container parameter is set to null, the method clears all/visible editors which belong to validationGroup (similar to the ASPxClientEdit.ClearGroup method).

If the validationGroup parameter is set to null, the method clears all/visible editors located within the container.

If both the container and validationGroup parameters are set to null, the method clears all/visible editors on a page.

Example

ASPxButton:

<dx:ASPxButton ID="clearBtn" runat="server" AutoPostBack="False" ClientInstanceName="clearBtn" Text="Clear Editors">
    <ClientSideEvents Click="function(s, e) {
        ASPxClientEdit.ClearEditorsInContainer(null);
    }" />
</dx:ASPxButton>

ASPxPopupControl:

<dx:ASPxPopupControl ID="Popup" runat="server" ClientInstanceName="Popup" PopupElementID="showPopupBtn"
    CloseAction="CloseButton" PopupHorizontalAlign="WindowCenter">
    <ClientSideEvents Closing="function(s, e) {
        ASPxClientEdit.ClearEditorsInContainerById('PopupCollection');
    }" />
    <ContentCollection>
        <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
            <div id="PopupCollection">
                <dx:ASPxTextBox ID="txtBox3" runat="server" ClientInstanceName="txtBox3" Width="170px">
                </dx:ASPxTextBox>
                <br />
                <dx:ASPxComboBox ID="comboBox2" runat="server" ClientInstanceName="comboBox2" DataSourceID="AccessDataSource1"
                    TextField="CompanyName" ValueField="CustomerID">
                </dx:ASPxComboBox>
                <br />
                <dx:ASPxTextBox ID="txtBox4" runat="server" ClientInstanceName="txtBox4" Width="170px">
                </dx:ASPxTextBox>
            </div>
        </dx:PopupControlContentControl>
    </ContentCollection>
</dx:ASPxPopupControl>

MVC:

settings.ClientSideEvents.CloseUp = "function(s, e){ ASPxClientEdit.ClearEditorsInContainer(document.getElementById('popupForm'),'',true);}";

Online Example

How to use ASPxClientEdit methods to clear editors within a specified container

See Also