当前位置:编程学习 > C#/ASP.NET >>

DataList中的ItemTemplate的ImageUrl问题

<asp:DataList ID="ProductInfo" RepeatColumns="5" runat="server" Width="140px" >
                                    <ItemTemplate>
                                        <div style="height: 210px; width: 140px">
                                            <table >
                                                <tr>
                                                    <td >
                                                        <asp:Image ID="Image4" runat="server" Height="120px" 
                                                            ImageUrl='<%# DataBinder.Eval(Container.DataItem,"ProductImage")%>'
                                                            Width="110px" />                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <div style="text-align: center">
                                                            <span style="font-size: 9pt;color:#666666">
                                                           <a href='ProductsDetail.aspx?ProductId=<%#Eval("ProductId") %>' target="_parent" style=" text-decoration:none"><%#DataBinder.Eval(Container.DataItem, " ProductName")%></a></span></div>
                                                    </td>
                                                </tr>
                                              
                                                <tr>
                                                    <td>
                                                        <div style="text-align: center">
                                                            <span style="font-size: 9pt; color:#666666">价格:<span style="color: #ff0033;font-size: 9pt">¥<%#DataBinder.Eval(Container.DataItem, "ProductPrice")%></span></span> </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <div style="text-align: center; width: 107px;">
                                                             <%--<a href='addProductCart.aspx?ProductName=<%#DataBinder.Eval(Container.DataItem,"ProductName")%>&ProductPrice=<%#DataBinder.Eval(Container.DataItem,"ProductPrice")%>' target="_parent">--%><asp:Image ID="Image5" runat="server" ImageUrl="Images/buy.gif" />
<%--                                                         </a>
--%>                                                        </div>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </ItemTemplate>
                            </asp:DataList>
简单来说我想绑定数据库的产品图片(字段是:ProductImage),但是图片没有显示出来(就只有一个叉),但是产品名称、价格用同样的方法,却能显示出来,这是为什么呢,请各们一定要帮我,我在网上找了很多资料了,都找不到解决方案。先谢谢各位了。 --------------------编程问答-------------------- 路径问题?右键页面看下源码匹配路径看下! --------------------编程问答-------------------- ProductImage存的路径是什么样子的 --------------------编程问答-------------------- ProductImage这个字段你保存的是图片的路径吗?路径对嘛?自己检查一下 --------------------编程问答-------------------- 1、检查图片是否存在文件夹
2、路径(可能在引用母版的时候……等) --------------------编程问答-------------------- 图片是在同一个文件夹吗? --------------------编程问答-------------------- 本身也有一个放产品图片的文件夹,名称叫“ProductPhoto”,但是我已经将它们都存到数据库中了啊。在数据库中的路径是“\Web\ProductInfo\ProductsPhotos\单相电子式多功能电能表\单相电子式多功能电能表.jpg”,里面有中文,这个有影响吗? --------------------编程问答-------------------- 你图片的路径相对于你页面的路径是对的吗?
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,