Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
Got it. I was using the wrong casing. Works by doing
@news.CreatorName.ToString()
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
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
Got it. I was using the wrong casing. Works by doing
@news.CreatorName.ToString()
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.