用于显示图片的代码。
HTML:
<asp:Repeater ID="Rep_slider" runat="server">
<ItemTemplate>
<div data-src='<%#("~/PicUpload/") + Eval("pic")%> ' runat="server">
<div class="camera_caption moveFromLeft camera_text_center">
<div class="caption_slider h2">
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
用于从DB中选择的代码:
var slideshow = from anything in obj.sliders
select anything;
Rep_slider.DataSource = slideshow.ToArray();
Rep_slider.DataBind();
答案 0 :(得分:3)
我认为你想要显示div与背景图像。尝试使用style="background-image:url('<%#("~/PicUpload/") + Eval("pic")%>')"
代替data-src