Tab

ASPxCardView.SettingsEditing Property

Provides access to the CardView's editing settings.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

Declaration

public ASPxCardViewEditingSettings SettingsEditing { get; }
Public ReadOnly Property SettingsEditing As ASPxCardViewEditingSettings

Property Value

Type Description
ASPxCardViewEditingSettings

An ASPxCardViewEditingSettings object that contains the CardView's editing settings.

Examples

The following example implements custom date validation in Batch Edit mode:

1) Use the BatchEditCardValidating event to check values on the client.

2) Use the CardValidating event to check values on the server.

3) Use the AllowValidationOnEndEdit property to switch between validation modes on the client side. If the variation between the HireDate and BirthDate columns is less than 18, input data is considered invalid and data update is not allowed.

View Example

<script type="text/javascript">
    function OnValidation(s, e) {
        if (!clientChkb.GetChecked()) {
            return;
        }
        var grid = ASPxClientCardView.Cast(s);
        var cellInfo1 = e.validationInfo[grid.GetColumnByField("BirthDate").index];
        var cellInfo2 = e.validationInfo[grid.GetColumnByField("HireDate").index];
        var years = CheckYears(cellInfo1.value, cellInfo2.value);
        if (years == null || years < 18) {
            cellInfo1.isValid = false;
            cellInfo2.isValid = false;
            cellInfo2.errorText = "Invalid difference between Hire Date and Birth Date";
            cellInfo1.errorText = "Invalid difference between Hire Date and Birth Date";
        } else {
            cellInfo1.isValid = true;
            cellInfo2.isValid = true;
        }
    }
    function CheckYears(date1, date2) {
        if (!date1 || !date2)
            return null;
        var msecPerYear = 1000 * 60 * 60 * 24 * 365;
        var years = (date2.getTime() - date1.getTime()) / msecPerYear;
        return years;
    }
</script>
<dx:ASPxCheckBox ID="ASPxCheckBox1" runat="server" ClientInstanceName="clientChkb"
    Checked="true" Text="ClientValidation">
</dx:ASPxCheckBox>
<dx:ASPxCheckBox runat="server" ID="ASPxCheckBox2" AutoPostBack="true" OnCheckedChanged="ASPxCheckBox2_CheckedChanged" Checked="false" Text="Validate on the Save Changes button click"></dx:ASPxCheckBox>
<dx:ASPxCardView ClientInstanceName="grid" DataSourceID="AccessDataSource1" KeyFieldName="EmployeeID" ID="ASPxCardView1" OnCardValidating="ASPxCardView1_CardValidating" runat="server" AutoGenerateColumns="False">
    <SettingsEditing Mode="Batch">
    </SettingsEditing>
    <Columns>
        <dx:CardViewTextColumn FieldName="EmployeeID" ReadOnly="True" VisibleIndex="0">
        </dx:CardViewTextColumn>
        <dx:CardViewTextColumn FieldName="LastName" VisibleIndex="1">
        </dx:CardViewTextColumn>
        <dx:CardViewTextColumn FieldName="FirstName" VisibleIndex="2">
        </dx:CardViewTextColumn>
        <dx:CardViewTextColumn FieldName="Address" VisibleIndex="3">
        </dx:CardViewTextColumn>
        <dx:CardViewDateColumn FieldName="BirthDate" VisibleIndex="4" Width="120px">
        </dx:CardViewDateColumn>
        <dx:CardViewDateColumn FieldName="HireDate" VisibleIndex="6" Width="120px">
        </dx:CardViewDateColumn>
    </Columns>
    <CardLayoutProperties>
        <Items>
            <dx