Log In
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Chart Control
  [Expand]Grid View
  [Collapse]Card View
   [Expand]Product Information
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Collapse]Data Editing
      Edit Form
      Adding and Deleting Cards
      Card Validation and Error Indication
      Edit Form Validation (Templates)
      Processing Custom Callbacks
      Batch Edit Mode
    [Expand]Data Shaping and Manipulation
    [Expand]Data Formatting
     Appearance Customization
     Save and Restore Layout
     Export Overview
   [Expand]Visual Elements
   [Expand]Member Tables
  [Expand]Vertical Grid
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Card Validation and Error Indication

This topic describes how to check the validity of data entered by end-users into a card view. ASPxCardView allows you to manually validate an edited card and display error icons for invalid fields.

Expanded Validating Cards

To implement card validation, you should handle the ASPxCardView.CardValidating event. This event is automatically raised when a card is about to be updated, and allows you to specify whether its data is valid or not. To manually force card validation, call the ASPxCardView.DoCardValidation method.

  • The event's OldValues and NewValues properties allow old and new card values to be obtained, respectively. These properties represent collections. Individual card values can be obtained by using index notation or by specifying the field name. The event's IsNewCard property identifies whether or not a new card is being edited by the user.

  • If the value is invalid, use the Errors property to specify the error description text. As a result, an error icon will be displayed next to the invalid value. Pointing to the icon shows a hint with an error description.

  • Use the CardError property to specify the error text displayed within the Card Error Row. This row is automatically displayed below the edited card if the CardError property is set to a non-empty string.

    Use the ASPxGridBehaviorSettings.EncodeErrorHtml option to specify whether or not ASPxCardView keeps its card errors that are HTML as HTML, or strips out the HTML markers instead.

Expanded Validating Edit Cells

Data columns provide various validation settings available by the EditProperties.ValidationSettings property. This allows you to define the validation logic for individual edit cells.

For example, you can use the ValidationSettings.RequiredField property to force an editor to require input, and specify an error message if input is not received.

Expanded Example

This example demonstrates how to check the validity of data entered by end-users into a card. Validation is implemented within the ASPxCardView.CardValidating event handler. In this sample, validation fails in the cases listed below:

  • field value(s) is empty;
  • Contact Name and/or Company Name fields are set to a single character.

The ASPxCardView.StartCardEditing event is handled to display errors (if any) within the edited card when an end-user switches to edit mode.

Expanded See Also

How would you rate this topic?​​​​​​​