MVC 3 AjaxHelper Ajax.ActionLink vs Ajax.RouteLink, Ajax.BeginForm vs AjaxBeginRouteForm

From my understanding

  • Ajax.ActionLink - creates a link to a specific action in the current controller
  • Ajax.RouteLink - create a link based on the RouteData provided to the assistant

However, I used MVC 3 and notice that Ajax.ActionLink has a lot of overloads that can take almost everything that Ajax.RouteLink can include RouteData, protocol, ActionName, ControllerName, etc.

The same applies to Ajax.BeginForm and Ajax.BeginRouteForm

So am I missing something or are outdated versions of the route?

+3
source share
1 answer

.Route versions are used to create links based on route (name) configurations.

(: global.asax)

routes.MapRoute(
    "faq",
    "pages/faq",
    new { controller = "Faq", action = "Index" }
);

- Html.ActionLink

@Ajax.ActionLink(linkText: "something", controller: "Faq", action: "Index")

- Html.RouteLink

@Ajax.RouteLink(linkText: "something", routeName: "faq")
+3

Source: https://habr.com/ru/post/1787915/


All Articles