GridView 中绑定图片路径
<asp:Image ID="Image1" runat="server" ImageUrl='~/Manager/UpLoadFile/<%#Eval("OrganizationCode").ToString()!= "0" ? Eval("OrganizationCode") : "暂无.jpg"%>'/>
这样写为什么不行, 页面查看源代码如下:
<img id="rp1_ctl00_Image1" src="../../Manager/UpLoadFile/%3C%25? Eval("OrganizationCode") : "暂无.jpg"%>#Eval(%22OrganizationCode%22).ToString()!=%20%220%22" style="border-width:0px;" />
------解决方案--------------------Refer:
http://www.cnblogs.com/insus/archive/2013/05/16/3081055.html
see also:
http://www.cnblogs.com/insus/archive/2013/05/18/3085114.html
------解决方案--------------------<img id="rp1_ctl00_Image1" src='<%#'../../Manager/UpLoadFile'+ Eval("path").ToString()==null :'暂无.jpg' ? Eval("path") />
试试...
------解决方案--------------------还少一个 %>
------解决方案--------------------
这个就用img就ok了.