BootstrapCardViewBuilderBase<T>.Routes(Action<CardViewRouteCollectionBuilder>) Method

Specifies a collection of routes for Card View updated or performing other Controller-side operations on demand.

Namespace: DevExpress.AspNetCore.Bootstrap

Assembly: DevExpress.AspNetCore.Bootstrap.v18.2.dll

Declaration

public T Routes(
    Action<CardViewRouteCollectionBuilder> config
)
Public Function Routes(
    config As Action(Of CardViewRouteCollectionBuilder)
) As T

Parameters

Name Type Description
config Action<CardViewRouteCollectionBuilder>

An Action that configures the CardViewRouteCollectionBuilder's functionality.

Returns

Type Description
T

A reference to this instance after the operation is completed.

Remarks

Important

Bootstrap Controls for ASP.NET Core are in maintenance mode. We don’t add new controls or develop new functionality for this product line. Our recommendation is to use the ASP.NET Core Controls suite.

Card View uses routes to configure AJAX requests used for client-server communication (navigation between pages, editing, sorting, etc.). For more information on configuring Bootstrap Core controls for AJAX, refer to the Configure Controls for AJAX article.

Card View provides you with three main routing types:

  • updating the control markup;
  • implementing the CRUD (create, update and delete) functionality;
  • implementing a custom server-side logic.

The example below demonstrates how to implement editing Card View items using the Routes method.

@model IEnumerable<EditableEmployee>

@(Html.DevExpress()
    .BootstrapCardView<EditableEmployee>()
    .Name("cardViewWithEditForm")
    .KeyFieldName(m => m.ID)
    .Routes(routes => routes
        .MapRoute(r => r
            .Action("EditingWithEditForm")
            .Controller("CardView"))
        .MapRoute(r => r
            .RouteType(CardViewRouteType.UpdateCard)
            .Action("UpdateCardEditForm")
            .Controller("CardView"))
        .MapRoute(r => r
            .RouteType(CardViewRouteType.DeleteCard)
            .Action("DeleteCardEditForm")
            .Controller("CardView")))
    .Columns(columns => {
        columns.Add(m => m.FirstName);
        columns.Add(m => m.LastName);
    })
    .CardLayoutProperties(cardLayoutProperties =>
        cardLayoutProperties.Items(items => {
            items.AddCommandItem()
                .ShowEditButton(true)
                .ShowDeleteButton(true)
                .HorizontalAlign(FormLayoutHorizontalAlign.Right);
            items.Add(m => m.FirstName);
            items.Add(m => m.LastName);
            items.AddEditModeCommandItem()
                .HorizontalAlign(FormLayoutHorizontalAlign.Right);
        }))
    .Bind(Model))
See Also