View/Razor Examples

Lots of examples of using various techniques to render data in a view

Rendering the raw value of a field from IPublishedContent

@Model.Value("bodyContent")

Rendering the converted value of a field from IPublishedContent

@Model.Value<double>("amount")
@Model.Value<IHtmlString>("bodyContent")

Rendering some member data

@if(Members.IsLoggedIn()){
    var profile = Members.GetCurrentMemberProfileModel();
    var umbracomember = Members.GetByUsername(profile.UserName);

    <h1>@umbracomember.Name</h1>
    <p>@umbracomember.Value<string>("bio")</p>
}

Last updated