I have this macro running happily on a live server. It was ok in WebMatrix. Now WebMatrix has updated itself to 2 (refresh), it won’t run some macros, this being one of them:-
@{
//Check there are slider image page loaded
var theCount = @Model.Descendants("SliderImagePage").Count();
if (theCount > 0)
{
foreach (var theImagePage in Model.Descendants("SliderImagePage"))
{
var theImage = theImagePage.Media("sliderImage","umbracoFile");
if (theImagePage.IsFirst())
{
@:<div class="slide" style="background-image:url('@Html.Raw(theImage)');display:block;"></div>
} else {
@:<div class="slide" style="background-image:url('@Html.Raw(theImage)');display:none;"></div>
}
}
}
else
{
@: No Picture Image pages set up
}
}
It complains that “:” is not valid at the start of a code block.
I have MVC4 and the Razor Extensions in VS2010. As far as I understand, it’s all valid. Can anyone shed any light on why it won’t pass validation?
Thanks.
The statements in the foreach loop should run fine without using @: for output: