日期:2014-05-17  浏览次数:20402 次

图片地址
<asp:Image ID="Image1" runat="server" ImageUrl='~/IMAGES/<%#Eval("Style") %>.jpg' Width="137" Height="48"/>

上面错误在哪里,,为什么在后面显示
http://localhost:5873/IMAGES/%3C%25#Eval(%22Style%22)%20%25%3E.jpg,,,没有显示正确的值
<%#Eval("Style") %>,拉出来,值就正确

------解决方案--------------------
用string.format

http://stackoverflow.com/questions/9348006/href-news-aspxid-evalid-not-work-in-linkbutton-asp-net
------解决方案--------------------
ImageUrl='~/IMAGES/<%#Eval("Style") %>.jpg'
=>
ImageUrl='<%#"~/IMAGES/"+Eval("Style") %>.jpg' 试试
------解决方案--------------------
<asp:Image ID="Image1" runat="server" ImageUrl='~/IMAGES/<%#Eval("Style") %>.jpg' 

不能这么用的吧,只能通过后台事件绑定

或者
------解决方案--------------------
要显示图片可以在后台写个public方法返回图片路径,前台调用这个方法就可以了