[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
   Getting Started
  [Expand]Grid View
  [Expand]Tree List
  [Collapse]Card View
   [Expand]Product Information
    Getting Started
    [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
   [Expand]Visual Elements
   [Expand]Member Tables
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [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]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Adding and Deleting Cards

Expanded Creating and Initializing New Cards

End-users can create new cards using the New command.

To allow end-users to add new cards, set the ASPxGridDataSecuritySettings.AllowInsert and the CardViewCommandLayoutItem.ShowNewButton properties to true.

To create cards in code, use the server ASPxCardView.AddNewCard or client ASPxClientCardView.AddNewCard method. These methods switch ASPxCardView to an edit mode and allow the values of the new card to be edited.

To initialize card values in code, handle the ASPxCardView.InitNewCard event.


In this example, the ASPxCardView.InitNewCard event is handled to initialize the new record's field values with default values.

The image below shows the result:

Expanded Adding Cards

To add a new record to the underlying data source, call the ASPxCardView.UpdateEdit (or ASPxClientCardView.UpdateEdit) method. End-users can do this by clicking the Update command.

You can also implement card validation. For information, see Card Validation and Error Indication.

After a new card has been added to ASPxCardView, the ASPxCardView.CardInserted event is raised. To cancel the insert operation, handle the ASPxCardView.CardInserting event.

Expanded Deleting Cards

End-users can delete cards using the Delete command. To do this in code, use the server ASPxCardView.DeleteCard or client ASPxClientCardView.DeleteCard method.

After a card has been deleted, the ASPxCardView.CardDeleted event is raised. To cancel the delete operation, handle the ASPxCardView.CardDeleting event.

To allow an end-user to cancel the delete operation, enable the ASPxGridBehaviorSettings.ConfirmDelete option. In this case, when the user deletes a card, the Confirm Delete window is automatically displayed.

The text displayed within the Confirm Delete window can be specified by the ASPxGridTextSettings.ConfirmDelete property.



Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T271569.

The example illustrates how to delete selected cards of the ASPxCardView bound with an in-memory DataSource.

Is this topic helpful?​​​​​​​