DotVVM Tip 01: Visible binding

Publish date:

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 the @if statement, use the Visible property on any HTML element and bind it to a boolean expression.

// Razor
@if (orders.Count == 0)
    <div class="order-list">
        <h2>No orders placed</h2>

// DotVVM
<div class="order-list" 
     Visible="{value: Orders.Count == 0}">
    <h2>No orders placed</h2>

There is also IncludeInPage with a similar meaning. The Visible property just hides the element using CSS display property while IncludeInPage removes it from the DOM.

Tomáš Herceg
Tomáš Herceg


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.

Others blog posts from category: DotVVM Blog