I have used asp's repeater to repeat 3 images per row but it shows only 1 image per row. why ?
I have tried every way I could but no effect.
<asp:Repeater ID="rptrImages" runat="server">
<ItemTemplate>
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<img src='<%# "UploadedImages/"+ Eval("Image") %>' alt="No Image" class="img-responsive img-rounded" />
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
The
<ItemTemplate>
within a repeater is the content that gets repeated for every object within the data source. All you need to do is refactor your template:Using the above, the
<div class="col-md-4">
will be repeated for each item in your data source and all contained within a single<div class="row">
, due to the nature of Bootstrap's columns they will automatically wrap onto another line within the same div once three are placed horizontally. If you need to hide the<div class="row">
should the repeater not contain any items then try the below:Then in your code-behind when binding the repeater:
Because the
<div class="row">
is within theHeaderTemplate
andFooterTemplate
it will not get rendered if you setVisible
to false.