ASPxEdit.ValidateEditorsInContainer(Control) Method
Performs validation of visible editors that are located within the specified container.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v18.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
container | Control | A Control object that specifies the container of the editors to be validated. |
Returns
Type | Description |
---|---|
Boolean | true if the specified visible editors pass validation; otherwise, false. |
Example
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-validate-editors-in-the-container-on-the-server-side-e3633
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>How to validate editors in container </title>
<script type="text/javascript" language="javascript">
function Validate(s, e) {
if (ASPxClientEdit.ValidateGroup('testGroup'))
ClientCallbackPanelDemo.PerformCallback('');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxButton ID="ASPxButtonSave" runat="server" Text="Validate" AutoPostBack="False">
<ClientSideEvents Click="Validate" />
</dx:ASPxButton>
<br />
<dx:ASPxCallbackPanel ID="ASPxCallbackPanelDemo" runat="server" HideContentOnCallback="False"
ClientInstanceName="ClientCallbackPanelDemo" OnCallback="ASPxCallbackPanelDemo_Callback">
<PanelCollection>
<dx:PanelContent ID="PanelContent1" runat="server">
<table cellspacing="0" cellpadding="4" runat="server" id="serverContainer">
<tr>
<td style="width: 60px;">
<dx:ASPxLabel runat="server" ID="NameLabel" AssociatedControlID="txtNum1" Text="Number 1:" />
</td>
<td>
<dx:ASPxTextBox ID="txtNum1" runat="server" Width="170px" OnValidation="ASPxTextBoxTest_Validation">
<ValidationSettings ValidationGroup="testGroup">
<RequiredField IsRequired="True" ErrorText="Number 1 is required" />
</ValidationSettings>
</dx:ASPxTextBox>
</td>
</tr>
<tr>
<td style="width: 60px;">
<dx:ASPxLabel runat="server" ID="ASPxLabel1" AssociatedControlID="txtNum2" Text="Number 2:" />
</td>
<td>
<dx:ASPxTextBox ID="txtNum2" runat="server" Width="170px" OnValidation="ASPxTextBoxTest_Validation">
<ValidationSettings ValidationGroup="testGroup">
<RequiredField IsRequired="True" ErrorText="Number 2 is required"/>
</ValidationSettings>
</dx:ASPxTextBox>
</td>
</tr>
</table>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
</div>
</form>
</body>
</html>
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ValidateEditorsInContainer(Control) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.