Copied to clipboard

Flag this post as spam?

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


  • JC 3 posts 23 karma points
    Sep 25, 2011 @ 12:36
    JC
    0

    Get creatorName using Razor

    Hi,

    I expect this is very simple, but I can't find an example of how to do it via Razor. I have the following code

     

    @foreach(var news in Model.umbNewsArticle)
    {
    @news.creatorName
    }

    What I would like to do is print out the creatorName attribute, however when ever I run this code is it returns null.

    This is the XML for a new item (based on standard Umbraco template)

    <umbNewsArea id="1062" parentID="1061" level="2" writerID="0" creatorID="0" nodeType="1057" template="1099" sortOrder="1" createDate="2010-09-07T13:22:05" updateDate="2011-09-25T10:20:17" nodeName="News" urlName="news" writerName="James" creatorName="James" path="-1,1061,1062" isDoc="">
    <umbNewsArticle id="1063" parentID="1062" level="3" writerID="0" creatorID="0" nodeType="1058" template="1100" sortOrder="1" createDate="2010-09-07T13:22:21" updateDate="2011-09-25T10:20:18" nodeName="Another record year" urlName="another-record-year" writerName="JC" creatorName="JC" path="-1,1061,1062,1063" isDoc="">
    <introduction>intro</introduction>
    <bodyText>stuff</bodyText>

     

    Thanks for the help

  • JC 3 posts 23 karma points
    Sep 25, 2011 @ 13:09
    JC
    0

    Got it. I was using the wrong casing. Works by doing

     

    @news.CreatorName.ToString()

Please Sign in or register to post replies

Write your reply to:

Draft