dimanche 3 juillet 2016

razor add class if condition is false

Hey i need to add class to div only if count is higher than 6 but i dont know where is the problem. Thanks for any advice

                @{
                    int count = 0;
                 }
                @foreach (var item in Model.Models)
                {
                    <div class="col-xxs-12 col-xs-6 col-sm-4 @(count < 6 ? "" : "dismiss")">
                        <a href="@Url.Action("Detail", "Product", new { productID = item.ProductID, parentCategoryID = item.CategoryID, isProductModel = true })" class="model-wrap">
                            <div class="box">
                                <div class="img-wrap" style="background-image: url( @Url.Content(Utils.ProductImagePath(item.ImageID)) )"></div>
                                <div class="arrow f16">@item.Name <i class="fa fa-angle-right theme-color" aria-hidden="true"></i></div>
                            </div>
                        </a>
                    </div>
                } count++;
            </div> 

Aucun commentaire:

Enregistrer un commentaire