在asp.net的网格视图中检索图像 [英] retrieve image in grid view in asp.net

查看:79
本文介绍了在asp.net的网格视图中检索图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有网格视图,并且在网格视图的模板字段中,我具有图像控件
并且此控件从sql server数据库2005绑定
我从sql server database 2005的表image列中检索此图像,只有图像名称插入而没有图像url
< asp:TemplateField>
< itemtemplate>

i have grid view and in the template field of grid view i have image control
and this control bind from sql server database 2005
i retrieve this image from sql server database 2005 in the table image column have only image name insert not image url
<asp:TemplateField>
<itemtemplate>

<asp:Image ID="Image1" runat="server" ImageUrl ='<%# Eval("Logo") %>'>
              </asp:Image>







但根据我的理解,图像无法通过图像控件检索







but image not retrieve by image control

推荐答案

Dude ..仅图像名称存储在数据库中,而imageurl存储在数据库中.因此,仅图像存储在数据库中名称,您将无法从数据库获取图像.还将图像路径绑定到Imageurl,如下所示.

Dude,as per my understanding..only the image name is stored in the database but the imageurl.So only with the image name you cannot get the image from database.Also bind the image path to the Imageurl as shown below.

ImageUrl='<%# String.Format("~/path/to/image/" + Eval("product_img")) %>'




将〜/path/to/image/替换为存储图像的路径.


--- Prathap.




Replace ~/path/to/image/ with the path where the images are stored.


---Prathap.


这篇关于在asp.net的网格视图中检索图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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