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我是菜人啊,有空没空的过来看一下

解决方案 »

  1.   

    <img  src='producepic/<%#DataBinder.Eval(Container.DataItem,"pic")%>' 
                            style="width: 160px" />
    应该这么写
    <img  src='<%#"producepic/"+Eval("pic")%>' 
                            style="width: 160px" />
      

  2.   

    <td>
                        
                        <img  src='producepic/<%#Eval("pic")%>' 
                            style="width: 160px" /></td> 
      

  3.   

     <img  src='producepic/<%#Eval("pic")%>' 
     style="width: 160px" /> <img  src='<%# "producepic/"+Eval("pic")%>' 
     style="width: 160px" />
    点击图片看看图片路径
      

  4.   

    <img  src=' <%# "producepic/"+Eval("pic")%>'
    style="width: 160px" /> 
      

  5.   

    请记住,只有服务器控件才支持绑定表达式。简单说,只有服务器控件才可能写 <%# .... %>。
      

  6.   


    哦sorry,没注意它是在模板控件中。这样写是可以的。那么就可以脱离开asp.net,从html角度到客户端测试去了。
      

  7.   

    加上runat="server"试试,不然的话你右键图片查看路径,复制到IE地址栏看能找到图片不
      

  8.   


     <img  src='producepic/<%#Eval("pic")%>' style="width: 160px" /></td> //如果还显示不出来,在生成的html页面看看图片路径,看到底是路径不对还是怎么。