Home Update div class in foreach loop using partial
Reply: 0

Update div class in foreach loop using partial

user1059
1#
user1059 Published in June 20, 2018, 1:32 am

I want create a blogs list with mvc razor. I have a partial for calling blogs item and a layout as master page. I want using zip layout (first item push to right secondary push to left and reset for next items).

Layout

@foreach (var item in Model.Listings)
{
     @Html.Partial("~/Views/Listing/_ListingCard.cshtml", item)
}



Partial

       <div class="card card-plain card-blog">
        <div class="row">
            <div class="col-md-5">
                <div class="card-image">
                 ///MyCodes
                </div>
            </div>
            <div class="col-md-7">
                <div class="card-body">
                ///MyCodes
                </div>
            </div>
        </div>
      </div>

I want change col-md-5 with col-md-7 per loop.
Can I do this without JS? Any idea please?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302284 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO