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
)
#Parameters
Name | Type | Description |
---|---|---|
config | Action<Card |
An Action that configures the Card |
#Returns
Type | Description |
---|---|
T | A reference to this instance after the operation is completed. |
#Remarks
IMPORTANT
Bootstrap Controls for ASP.
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))