The code below is filled with information from the database to load dynamically the banner banners.
But I have click problem in data-target
, where it is not going to the given image.
Obs. I have tried to put the object @item.BannerOrdem
, but nothing happens.
div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
<ol class="carousel-indicators">
@foreach (var item in Model.ListBanners)
{
<li data-target="#" data-slide-to="@item.BannerOrdem" class="active"></li>
}
</ol>
<div class="carousel-inner" role="listbox">
@foreach (var item in Model.ListBanners)
{
@if (Model.ListBanners.IndexOf(item) == 0)
{
<div class="item active">
<img src="data:image/jpg;base64, @Convert.ToBase64String(item.BannerImagem)" style="width: 1286px; height: 350px;" alt="ASP.NET" class="img-responsive" />
<div class="carousel-caption" role="option">
</div>
</div>
}
else
{
<div class="item">
<img src="data:image/jpg;base64, @Convert.ToBase64String(item.BannerImagem)" style="width: 1286px; height: 350px;" alt="ASP.NET" class="img-responsive" />
<div class="carousel-caption" role="option">
</div>
</div>
}
}
@*<div class="item">
<img src="@item2.BannerImagem" alt="Visual Studio" class="img-responsive" />
<div class="carousel-caption" role="option">
</div>
</div>*@
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>