如何在列表视图中查看数据库中的图像 [英] how to view image from database in a listview

查看:78
本文介绍了如何在列表视图中查看数据库中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:

我写了这段代码的代码:

hi all:
I wrote this peace of code:

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" GroupItemCount="10">
                <AlternatingItemTemplate>
                    <td runat="server" style="background-color: #FAFAD2;color: #284775;">name:
                        <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
                        <br />photo:
                        <asp:Label ID="photoLabel" runat="server" Text='<%# Eval("photo") %>' />
                        <br />category:
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
                        <br />available_quantity:
                        <asp:Label ID="available_quantityLabel" runat="server" Text='<%# Eval("available_quantity") %>' />
                        <br /></td>
                </AlternatingItemTemplate>
                <EmptyDataTemplate>
                    <table runat="server" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                        <tr>
                            <td>No data was returned.</td>
                        </tr>
                    </table>
                </EmptyDataTemplate>
                <EmptyItemTemplate>
<td runat="server" />
                </EmptyItemTemplate>
                <GroupTemplate>
                    <tr id="itemPlaceholderContainer" runat="server">
                        <td id="itemPlaceholder" runat="server"></td>
                    </tr>
                </GroupTemplate>
                <ItemTemplate>
                    <td runat="server" style="background-color: #FFFBD6;color: #333333;">name:
                        <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
                        <br />photo:
                        <asp:Label ID="photoLabel" runat="server" Text='<%# Eval("photo") %>' />
                        <br />category:
                        <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' />
                        <br />available_quantity:
                        <asp:Label ID="available_quantityLabel" runat="server" Text='<%# Eval("available_quantity") %>' />
                        <br /></td>
                </ItemTemplate>
                <LayoutTemplate>
                    <table runat="server">
                        <tr runat="server">
                            <td runat="server">
                                <table id="groupPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                    <tr id="groupPlaceholder" runat="server">
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr runat="server">
                            <td runat="server" style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;"></td>
                        </tr>
                    </table>
                </LayoutTemplate>
            </asp:ListView>





i希望在此列表视图中查看图像。列照片包含图像的名称,图像存储在文件夹中。我想在列表视图中查看这些图像..任何帮助将不胜感激。 thx提前:)



i want to view image in this list view. the column photo contains the name of the image and the images are stored in a folder . i want to view these images in the list view.. any help will be appreciated. thx in advance :)

推荐答案

您可以尝试 Google [ ^ ]解决方案。

请参考以下链接:

在Listview中显示图像ASP.net中的数据库 [ ^ ]

[ ^ ]

如何使用Eval()将图像从数据库检索到Listview [ ^ ]





- Amit
You could have tried Google[^] for the solution.
Refer the links below:
Show Image in Listview retrieve from database in ASP.net[^]
How To Retrieve Image from Database in ListView Control in asp.net 3.5 [^]
How to Retrieve Images from Database into Listview using Eval()[^]


--Amit


这篇关于如何在列表视图中查看数据库中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆