Skip to main content

MVCxCardViewEditingSettings.DeleteCardRouteValues Property

Defines the callback routing logic by specifying the names of a Controller and an Action which should handle callbacks related to card deletion.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v23.2.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public object DeleteCardRouteValues { get; set; }

Property Value

Type Description
Object

An object containing the Controller and Action names.

Property Paths

You can access this nested property as listed below:

Object Type Path to DeleteCardRouteValues
CardViewSettings
.SettingsEditing .DeleteCardRouteValues
MVCxCardView
.SettingsEditing .DeleteCardRouteValues

Remarks

If card deletion is allowed for CardView, you should provide an associated controller action that will apply delete operations to a Model and return the CardView’s partial view. Use the DeleteCardRouteValues property to reference this controller action by its name and the name of its controller.

Note that in an action that handles update operations, you can obtain the edited object using our specific DevExpressEditorsBinder model binder.

View (CardViewPartial):

var CardView = Html.DevExpress().CardView(
        settings =>
        {
            settings.Name = "cvEditing";
            settings.KeyFieldName = "ProductID";
            settings.CallbackRouteValues = new { Controller = "CardView", Action = "CardViewPartial" };
            ...
            settings.SettingsEditing.DeleteCardRouteValues = new { Controller = "CardView", Action = "CardViewDeletePartial" };
            ...
    CardView.Bind(Model).Render();

Controller (‘CardViewController’):

public partial class CardViewController : Controller {
        ...
        public ActionResult CardViewPartial() {
            return PartialView("CardViewPartial", NorthwindDataProvider.GetEditableProducts());
        }
        ...
        [HttpPost]
        public ActionResult CardViewDeletePartial(int productID) {
            if(productID > 0) {
                try {
                    NorthwindDataProvider.DeleteProduct(productID);
                }
                catch(Exception e) {
                    ViewData["EditError"] = e.Message;
                }
            }
            return PartialView("CardViewPartial", NorthwindDataProvider.GetEditableProducts());
        }
        ...
See Also