Umbraco Razor For Each Check for ODD and Even
This script is for something else (an rss feed from Vimeo), but the bits to check for ODD and EVEN are Highlighted in Yellow @using umbraco.MacroEngines @inherits DynamicNodeContext @using System.Xml; <div id="portfolio-wrapper" style="position: relative; overflow: hidden; height: 921px;" class="isotope"> @{ var odd = true; } @{ //Get the XML from remote URL XmlDocument xml = new XmlDocument(); //URL currently hardcoded - but you could use a macro param to pass in URL xml.Load("******"); //Select the nodes we want to loop through XmlNodeList nodes = xml.SelectNodes("//item"); //Traverse the entire XML nodes. foreach (XmlNode node in nodes) { //Get the value from the <title> node var title = node.SelectSingleNode("title").InnerText; ...