Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tarunjit 103 posts 146 karma points
    Apr 14, 2016 @ 07:45
    Tarunjit
    0

    Accessing Model in static content page

    Hi All,

    We have a template inheriting from UmbracoViewPage with model passed to it as shown in code snippet below.

    @inherits Umbraco.Web.Mvc.UmbracoViewPage {Models.UserDetails}

    This passed model have property such as “FirstName” passed.

    We want to access this model value in Static content page. Is this possible if yes please let me know the technique to do it.

    We tried it using macro but not able to access it.

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Apr 14, 2016 @ 11:22
    Dennis Adolfi
    0

    Try this:

    @using Models = Umbraco.Web.PublishedContentModels;
    @inherits Umbraco.Web.Mvc.UmbracoViewPage<Models.UserDetails>
    
    @Model.FirstName 
    

    Also reed this interesing article about Strongly typed vs. Dynamic Content Access by Dave Woestenborghs and you will quickly become a content access ninja. :) http://24days.in/umbraco/2015/strongly-typed-vs-dynamic-content-access/

Please Sign in or register to post replies

Write your reply to:

Draft