asp.net 中的相册
我正在使用 Visual Studio 2008,数据库为 SQL Server 2005 我需要创建一个相册 我使用列表视图控件来显示
我的表包含的数据:> 邮箱_ID 标题 描述 图像
我使用通用处理程序将二进制数据转换为图像
现在主要问题是当我上传照片时它已正确上传到我的数据库 但是当我尝试显示图像时 第一个带有 Email_Id 的图像仅显示在列表视图控件中
<asp:ListView ID="ListView1" runat="server" GroupItemCount="4"
DataSourceID="SqlDataSource1" DataKeyNames="Email_Id">
<LayoutTemplate>
<asp:Placeholder
id="groupPlaceholder"
runat="server" />
</LayoutTemplate>
<GroupTemplate>
<div>
<asp:Placeholder
id="itemPlaceholder"
runat="server" />
</div>
</GroupTemplate>
<ItemTemplate>
<div style="font-size:medium;">
<asp:Image id="picAlbum" runat="server" width="150px" Height="200px"
ImageUrl='<%# "~/PHandler.ashx?Email_Id=" + Eval("Email_Id") %>' />
</div>
</ItemTemplate>
<EmptyItemTemplate>
</EmptyItemTemplate>
</asp:ListView>
<br />
<br />
<br />
” SelectCommand="SELECT [Email_Id]、[标题]、[描述]、[图像] FROM [图片集] WHERE ([Email_Id] = @Email_Id)">
谁能帮帮我 我想在我的相册中显示特定email_id上传的所有图片
i am working visual studio 2008 with database as sql server 2005
i need to create a photo album
i used listview control to display data
my table contains :>
Email_Id
title
description
Image
i used generic handler to convert binary data into image
now the main problem is when i upload photo it is uploaded to my database properly
but when i try to display the image
the first image with Email_Id is only shown in listview controls
<asp:ListView ID="ListView1" runat="server" GroupItemCount="4"
DataSourceID="SqlDataSource1" DataKeyNames="Email_Id">
<LayoutTemplate>
<asp:Placeholder
id="groupPlaceholder"
runat="server" />
</LayoutTemplate>
<GroupTemplate>
<div>
<asp:Placeholder
id="itemPlaceholder"
runat="server" />
</div>
</GroupTemplate>
<ItemTemplate>
<div style="font-size:medium;">
<asp:Image id="picAlbum" runat="server" width="150px" Height="200px"
ImageUrl='<%# "~/PHandler.ashx?Email_Id=" + Eval("Email_Id") %>' />
</div>
</ItemTemplate>
<EmptyItemTemplate>
</EmptyItemTemplate>
</asp:ListView>
<br />
<br />
<br />
"
SelectCommand="SELECT [Email_Id], [Title], [Description], [Image] FROM [Picture_album] WHERE ([Email_Id] = @Email_Id)">
can any one help me out
i want to show all the image uploaded by the specific email_id in my photo ablum
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Phandler.ashx 仅获取 email_id。您需要提供更多信息才能知道要加载哪个图像。更改您的表以包含唯一标识符或时间戳字段,并将其传递给您的处理程序。此外,您不应该从此页面选择图像字段,因为处理程序应该这样做。
Phandler.ashx is only getting email_id. You will need to give it more to know which image to load. Alter your table to include a uniqueiidentifier or timestamp field and pass that to you handler instead. Also you should not be selecting the image field from this page as the handler should be doing that.