I'm having a hell of a time getting something which should be simple to work. Is there something simple i've missed or are there bugs in Umbraco's Razor parser?
Carousel.cshtml(35): error CS0117: 'umbraco.item' does not contain a definition for 'linkText'
Is it me or is it Umbraco?
I'm having a hell of a time getting something which should be simple to work. Is there something simple i've missed or are there bugs in Umbraco's Razor parser?
Carousel.cshtml(35): error CS0117: 'umbraco.item' does not contain a definition for 'linkText'
@*
CAROUSEL MACRO
=======================
Creates and displays the carousel.
*@
@{
var carousel = @Model.Descendants("carousel").FirstOrDefault();
string itemCount = umbraco.library.GetPreValueAsString(@carousel.itemCount);
string cssClass;
if (carousel != null)
{
if (itemCount == "3 item")
{
cssClass = "col w634";
}
else
{
cssClass = "col w880 bgPanel3 pt40 pr40 pl40 pb40";
}
<div class="@cssClass">
<div class="rv_gallery carousel">
<div class="rv_strip_wrapperh h230 wrapper" >
<div class="slider h230 clearfix">
foreach (var item in @Model.Descendants("carouselItem").Where("visible"))
{
<div class="item">
<a class="carouselItemLink" href="#"></a>
<div class="promoFrame promoFrame160">
<div class="promoFrameFrame"></div>
<div class="promoFrameImage">
<img alt="@item.linkText" src="@item.image">
</div>
</div>
<a class="arrowLink" href="#">item.linkText</a>
</div>
}
</div>
</div>
</div>
</div>
}
}
First of all, is there a property on the carouselItem documentType that has an alias of "linkText"?
You could try to do a "dynamic item" instead of "var item", I haven't tested your code so that might not help. :-)
Thanks for the reply..... I've just managed to solve the issu now but it looks like a bug to me.
If I move the closing bracket from around the entire code block and place it under the initializers like thus. The code works..... weird.
@{
var carousel = @Model.Descendants("carousel").FirstOrDefault();
string itemCount = umbraco.library.GetPreValueAsString(@carousel.itemCount);
string cssClass;
}
is working on a reply...