0

I have a ListView with the following ItemTemplate

<div class="row">
    <asp:ListView ID="lvResults" runat="server">
        <ItemTemplate>
            <div class="col-md-3 portfolio-item">
                <!-- Some content -->
            </div>
        </ItemTemplate>
    </asp:ListView>
</div>

I'm using Bootstrap for frontend, and as you can see I have the whole ListView is wrapped in a div with the class row.

However, instead of having one row for the whole ListView, I would like to add a new row for every X item.

For example, if I have 4 items in the ListView, instead of this

<div class="row>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
</div>

I want this:

<div class="row>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
</div>
<div class="row>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
    <div class="col-md-3 portfolio-item">
        <!-- Some content -->
    </div>
</div>

Is this possible?

Siguza
  • 21,155
  • 6
  • 52
  • 89
Boxiom
  • 2,245
  • 6
  • 40
  • 51

1 Answers1

0

I ended up using a simply JQuery script to solve this. The script can be found here, if anyone else is interested:

https://stackoverflow.com/a/7248506/2358221

Community
  • 1
  • 1
Boxiom
  • 2,245
  • 6
  • 40
  • 51