@model Boolean? @{ Layout = "_FieldLayout.cshtml"; var htmlAttributes = new RouteValueDictionary(); if (ViewBag.@class != null) { htmlAttributes.Add("class", ViewBag.@class); } } @if (Model.HasValue && Model.Value) { } else { }