I'm rewriting an XSLT macro to razor in Umbraco 6. I want to store the number of items from a multi-picker in a variable (recordCount), then compare it to zero. I've tried so many things and I can't figure it out. If I take away this:
@{ if (Model.Content.HasValue("cprHighlights")) { var typedMultiNodeTreePicker = new DynamicXml(Model.Content.GetPropertyValue("cprHighlights"));
var typedPublishedMNTPNodeList = new List(); foreach (dynamic id in typedMultiNodeTreePicker) { typedPublishedMNTPNodeList.Add(id.InnerText); } var typedMNTPCollection = Umbraco.TypedContent(typedPublishedMNTPNodeList).Where(x => x != null);
simple question : compare a number
I'm rewriting an XSLT macro to razor in Umbraco 6. I want to store the number of items from a multi-picker in a variable (recordCount), then compare it to zero. I've tried so many things and I can't figure it out. If I take away this:
and this:
Everything is fine.
What am I missing?
Hi Jacob,
I think the only issue is some additional @s, try this:
Jeavon
Yes, that was it. Thank you for looking at this. I guess I need to take a break.
Awesome, actually the Any method is slightly more efficient, e.g.
if(typedMNTPCollection.Any()) {}
Jeavon
Why thank you! I will use that instead.
is working on a reply...