Skip to main content

RouteCollectionBuilder<TBuilder, TRouteType>.MapRoute(Action<ControlRouteBuilder<TRouteType>>) Method

Defines the request routing logic by specifying the request type along with the names of a Controller and an Action, which should handle it.

Namespace: DevExpress.AspNetCore.Bootstrap

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

Declaration

public TBuilder MapRoute(
    Action<ControlRouteBuilder<TRouteType>> config
)

Parameters

Name Type Description
config Action<ControlRouteBuilder<TRouteType>>

An action performing the required configurations through a ControlRouteBuilder object.

Returns

Type Description
TBuilder

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.

$1 Use the MapRoute method to associate requests of the specified type with the specific handling action on the controller side. To achieve this, you need to provide the following settings:

  • RouteType - Specifies the type of the requests to handle. Skip this setting to specify the default route.
  • Controller - Specifies the name of a controller, whose action should handle the request.
  • Action - Specifies the name of a controller action to handle the request.
  • RouteValues - Allows you to specify the route in a cusotom form (e.g., to pass aditional parameters to the handling action).

The code sample below shows how to specify routes to handle various requests from the Grid View control:

@(Html.DevExpress()
    .BootstrapGridView<EditableEmployee>()
    .Name("gridView")
    .Routes(routes => routes
        .MapRoute(r => r
            .Controller("Home"))
            .Action("GridViewPartialView")
        .MapRoute(r => r
            .RouteType(GridViewRouteType.AddRow)
            .Action("InsertRow")
            .Controller("Home"))
        .MapRoute(r => r
            .RouteType(GridViewRouteType.UpdateRow)
            .Action("UpdateRow")
            .Controller("Home"))
        .MapRoute(r => r
            .RouteType(GridViewRouteType.DeleteRow)
            .Action("DeleteRow")
            .Controller("Home")))
    .Bind(Model))
    ...
See Also