<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> CataloguePDF <% %> <% var prods = Model.Products.Where(x => !x.Cancelled).ToList().OrderBy(o => o.Product.Brand.Name).ThenBy(o1 => o1.Product.Range.Name).ThenBy(o2 => o2.Product.Name).ToList(); string brand = ""; string range = ""; long count = 0; foreach (var p in prods) { count++; %> <% if(count % 2 == 0) { %> <% } %> <% } %>
<%= p.Product.Brand.Name %> - <%= p.Product.Range.Name %> - <%= p.Product.Name %>