DotVVM Tip 03: Generate URLs using RouteLink

Published: 10/31/2022 1:06:00 PM

DotVVM Tips is a series of short articles showing interesting features of DotVVM. To learn more, visit our Docs site.

DotVVM syntax is different from Razor. Instead of concatenating parts of URLs, the RouteLink component can build links to other pages from the route name and its parameters.

// Razor
<a href="myorders/@item.OrderId" 
   class="btn btn-success">
    Track &gt;

// DotVVM
<dot:RouteLink RouteName="OrderDetails" 
               Param-id="{value: OrderId}"
               class="btn btn-success">
    Track &gt;

The routes are registered in DotvvmStartup.cs file, and you can supply any parameters using the Param-* properties.

Tomáš Herceg

I am the CEO of RIGANTI, a small software development company located in Prague, Czech Republic.

I am Microsoft Most Valuable Professional and the founder of DotVVM project.