O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating Outgoing URLs

Routes are more important in an MVC framework application than in a Web Forms application because we are intimately engaged in the HTML that our application generates. To that end, there are a set of helper methods that we can use in views to generate URLs from the routing system. The simplest way to generate an outgoing URL in a view is to call the Html.ActionLink helper. Listing 27-6 shows this helper used in the List.cshtml view of the Registration controller.

Listing 27-6. Calling the ActionLink helper

@model IEnumerable<EventRegistration.Models.Domain.Registration> @using EventRegistration.Infrastructure @{     ViewBag.Title = "List";     Layout = "~/Views/Shared/CustomLayout.cshtml"; } @Html.RegistrationCount(@Model.Count()) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required