DotVVM Tip 03: Generate URLs using RouteLink

|
Publikováno:

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;
</a>

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

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

Tomáš Herceg
Tomáš Herceg

BIO: 

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

I am a Microsoft Regional Director and Microsoft Most Valuable Professional.

I am the author of DotVVM, an open source .NET-based web framework which lets you build Line-of-Business applications easily and without writing thousands lines of Javascript code.

Ostatní články z kategorie: DotVVM Blog