Skip to main content

ASPxEdit.ValidateEditorsInContainer(Control) Method

Performs validation of visible editors that are located within the specified container.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v22.2.dll

NuGet Package: DevExpress.Web


public static bool ValidateEditorsInContainer(
    Control container


Name Type Description
container Control

A Control object that specifies the container of the editors to be validated.


Type Description

true if the specified visible editors pass validation; otherwise, false.



The ValidateEditorsInContainer method validates both initial and changed editor values.


This example demonstrates how to validate editors in a container on the server side. The ASPxEdit.ValidateEditorsInContainer method is used to determine the validity of editors within a callback panel.

View Example

<title>How to validate editors in container </title>

<script type="text/javascript" language="javascript">
    function Validate(s, e) {
        if (ASPxClientEdit.ValidateGroup('testGroup'))

    <form id="form1" runat="server">
        <dx:ASPxButton ID="ASPxButtonSave" runat="server" Text="Validate" AutoPostBack="False">
            <ClientSideEvents Click="Validate" />
        <br />
        <dx:ASPxCallbackPanel ID="ASPxCallbackPanelDemo" runat="server"  HideContentOnCallback="False"
            ClientInstanceName="ClientCallbackPanelDemo" OnCallback="ASPxCallbackPanelDemo_Callback">
                <dx:PanelContent ID="PanelContent1" runat="server">
                    <table cellspacing="0" cellpadding="4" runat="server" id="serverContainer">
                            <td style="width: 60px;">
                                <dx:ASPxLabel runat="server" ID="NameLabel" AssociatedControlID="txtNum1" Text="Number 1:" />
                                <dx:ASPxTextBox ID="txtNum1" runat="server" Width="170px" OnValidation="ASPxTextBoxTest_Validation">
                                    <ValidationSettings ValidationGroup="testGroup">
                                        <RequiredField IsRequired="True" ErrorText="Number 1 is required" />
                            <td style="width: 60px;">
                                <dx:ASPxLabel runat="server" ID="ASPxLabel1" AssociatedControlID="txtNum2" Text="Number 2:" />
                                <dx:ASPxTextBox ID="txtNum2" runat="server" Width="170px" OnValidation="ASPxTextBoxTest_Validation">
                                    <ValidationSettings ValidationGroup="testGroup">
                                        <RequiredField IsRequired="True" ErrorText="Number 2 is required"/>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxEditors;
using DevExpress.Web.ASPxCallbackPanel;

public partial class _Default : System.Web.UI.Page {

    protected void Page_Init (object sender, EventArgs e) {


    protected void ASPxCallbackPanelDemo_Callback (object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) {
        ASPxCallbackPanel callbackPanel = (ASPxCallbackPanel)sender;
        bool isValid = ASPxEdit.ValidateEditorsInContainer(callbackPanel);
    protected void ASPxTextBoxTest_Validation (object sender, ValidationEventArgs e) {
        ASPxTextBox txt = sender as ASPxTextBox;
        int val;
        bool result = Int32.TryParse(txt.Text, out val);
        e.IsValid = result;
        e.ErrorText = "An input value should be a number";
See Also