Click here to Skip to main content
15,886,736 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I still have two annoying things:
1. When I add images is not stopped me in the form of Carousel - only after I do save and edit again - see it in the form of Carousel.
2. When I press the arrow he passes an empty picture - and then do not see any images, only the keys.

the code in view(edit):
HTML
<div class="col-md-4">
 <div class="col-md-5">
  <div id="images">
   <div id="myCarousel" class="carousel slide" data-ride="carousel">
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
      <li data-target="#myCarousel" data-slide-to="3"></li>
    </ol>
    <div class="carousel-inner" role="listbox">
     @{
       int x = 0;
       int x1 = 0;
       string cssClass = "item active";
       foreach (var img in Model.POIsImages)
       {
        @Html.Hidden("imageids[" + x1 + "]", img.ImageId);
        <div class="@cssClass">
          <input type="hidden" name="keep[@x]" value="1" data-imageid="@x" />
          <a class="darken" >
          <img id="image" class="img-rounded" data-imageid="@x" src="@Url.RouteUrl("Media", new { id = img.FileId })" width="80" height="80" />
          <span class="hoverText" data-imageid="@x">Remove</span>
          </a>
       </div>
        x1++;
        x++;
        cssClass = "item";
       }
       @Html.Hidden("NumberofImages", x);
     }
    </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>
 </div>
 @if (Model.POIsImages.Count == 0)
 {
   <div id="noimage" class="text-center h3"><br /><br />No Images Uploaded</div>
 }
 </div>
</div>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900