asp:DataList ID="DataList2" runat="server" RepeatDirection="Horizontal"
Width="401px">
<ItemTemplate>
<table style="width:97%; height: 150px;">
<tr>
<td>
<img src='producepic/<%#DataBinder.Eval(Container.DataItem,"pic")%>'
style="width: 160px" /></td> //这句没错吧
</tr>
</table>
</ItemTemplate>
</asp:DataList>那句没有错吧,图片怎么就显视不出来啊,但是在浏览器上显示的路径是对的啊
asp.net我是菜人啊,有空没空的过来看一下
style="width: 160px" />
应该这么写
<img src='<%#"producepic/"+Eval("pic")%>'
style="width: 160px" />
<img src='producepic/<%#Eval("pic")%>'
style="width: 160px" /></td>
style="width: 160px" /> <img src='<%# "producepic/"+Eval("pic")%>'
style="width: 160px" />
点击图片看看图片路径
style="width: 160px" />
哦sorry,没注意它是在模板控件中。这样写是可以的。那么就可以脱离开asp.net,从html角度到客户端测试去了。
<img src='producepic/<%#Eval("pic")%>' style="width: 160px" /></td> //如果还显示不出来,在生成的html页面看看图片路径,看到底是路径不对还是怎么。