问题与来自asp.net数据库中的显示图像 [英] proble with display image from database in asp.net

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

问题描述

我将路径和名称文件保存在databse中
并想在中继器中显示
但是
图片未显示
请帮助
tnx


i save path and name file in databse
and want to display in repeater
but
the picture don''t displayed
please help
tnx


<asp:Repeater ID="Repeater1" runat="server">
   <ItemTemplate>
     <a href="<%#Eval("filenameOrginal") %>">
     <img src="<%#Eval("flienameThumb") %>" />   </a>
   </ItemTemplate>
</asp:Repeater>







dal db = new dal();
DataTable dt = new DataTable();
dt = db.run_dr("select * from picgallery where show='true' ");
Repeater1.DataSource = dt;
Repeater1.DataBind();



我将文件的路径和名称保存到数据库中,如下所示:
gallerypic/orginal/12.jpg

我尝试这样做:
〜/gallerypic/orginal/12.jpg
或:
../gallerypic/orginal/12.jpg

在浏览器的源代码中:



i save path and name of file to database like this:
gallerypic/orginal/12.jpg

i try this to:
~/gallerypic/orginal/12.jpg
or:
../gallerypic/orginal/12.jpg

in source code of browser:

<a href="gallerypic/orginal/12.jpg">
<img src="gallerypic/thumb/12.jpg" />





<a href="~/gallerypic/orginal/12.jpg">
<img src="~/gallerypic/thumb/12.jpg" />

推荐答案

可能您应该使用处理程序来显示数据库中的图像.从转发器中的处理程序映射图像的过程与gridview相同.
请参考以下链接:
使用ASP.NET转发器控件 [将图像插入数据库并通过handler.ashx [
Probably you should use a handler to show the image from database. The procedure of mapping the images from handler in repeater is same as gridview.
Refer the links below:
Using the ASP.NET Repeater Control [^]
Inserting images into database and display it in gridview through handler.ashx[^]


--Amit


检查"picgallery"文件夹的文件系统权限.
还要检查文件夹的名称,首先说"gallerypic",然后说"picgallery".

您是否将应用程序放在IIS中或在VS deveop上运行. Web服务器?
开发人员服务器有时可以忘记"提供图像,请尝试在IIS上部署应用程序.
Check file system permissions for "picgallery" folder.
Also check the names of you folder, first you say "gallerypic" then "picgallery".

Did you put your app in IIS or are you running on VS deveop. web server?
Dev. server can sometimes ''forget'' to serve images, try deploying app ti IIS.


您可以参考这些文章

通过ASP.NET MVC从SQL Server下载和上传图像 [ ^ ]


在ASP.NET中上传和下载文件 [ ^ ]
you can refer these articals

Download and Upload Images from SQL Server via ASP.NET MVC[^]
and

File Upload and Download in ASP.NET[^]


这篇关于问题与来自asp.net数据库中的显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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