Posted on 29/09/2014 15:47:43
Hi Nicolai,
thank you for your patience :-).
I have jumped a bit a head. I'm trying to build a slider, where I have made an item list, which contains images, caption text etc.
Now I wanna iterate through these items in my item list.
So far I have this, but it gives me errors:
@{
var items = GetLoop("Item.Items");
var id = string.Format("carousel-{0}", GetValue("Item.Id"));
}
<p> @items </p>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
@for (var i = 0; i < items.Count; i++) {
var tabid = items[i];
if (i == 0) {
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
} else {
<li data-target="#carousel-example-generic" data-slide-to="@i"></li>
}
}
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
@for (var i = 0; i < items.Count; i++) {
var item = items[i];
if (i == 0) {
<div class="item active">
<img src="@item.GetValue(Item.Items.Billede)" alt="billede">
<div class="carousel-caption">
@item.GetValue(Item.Items.BilledTekst);
</div>
</div>
} else {
<div class="item">
<img src="@item.GetValue(Item.Items.Billede)" alt="billede">
<div class="carousel-caption">
@item.GetValue(Item.Items.BilledTekst);
</div>
</div>
}
}
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>