I want to put <hr />
in the repeater after 3 replies/products.
This is my repeater code:
<asp:Repeater ID="RptrProduct" runat="server">
<ItemTemplate>
<figure class="span4 slide">
<a href="#">
<img src="<%#"/images/product/"+Eval("ProductImage")%>" alt="" class="pro-img" />
</a>
<span class="title" style="margin-left: 50px;"><a href="#"><%#Eval("ProductName") %></a></span>
</figure>
</ItemTemplate>
</asp:Repeater>
And this is my .cs code for bind repeater:
BL_Product blp = new BL_Product();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RptrProduct.DataSource = blp.ListProduct();
RptrProduct.DataBind();
}
}
Just add <% if ((Container.ItemIndex + 1) % 3 == 0) { %> <hr /><% } %>
below the figure tag closing.
<asp:Repeater ID="RptrProduct" runat="server">
<ItemTemplate>
<figure class="span4 slide">
<a href="#">
<img src="<%#"/images/product/"+Eval("ProductImage")%>" alt="" class="pro-img" />
</a>
<span class="title" style="margin-left: 50px;"><a href="#"><%#Eval("ProductName") %></a></span>
</figure>
<% if ((Container.ItemIndex + 1) % 3 == 0) { %>
<hr />
<% } %>
</ItemTemplate>
</asp:Repeater>