图像数据绑定在datalist中的自定义绑定 [英] image databinding custom binding in datalist

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

问题描述

我在数据库中的图像路径是这样的:〜/ Pictures / bros.jpg

其中图片是用于存储上传图像的文件夹。



那么如何绑定图像以在datalist中显示。



过去如果路径只是bros.jpg我的图像数据绑定自定义绑定代码将是Eval(Image,Pictures / {0})其中Image是我的数据库列,Picture是文件夹。这很好,但目前的路径是〜/ Pictures / bros.jpg。

我应该在自定义绑定中放置什么代码?

My image path in database is like this : ~/Pictures/bros.jpg
where the Pictures is a folder to store images that was uploaded.

So how do i bind the image to display in datalist.

In the past if the path is just bros.jpg my image databinding custom binding code would be Eval("Image", "Pictures/{0}") where Image is my database column and Picture is the folder. This works fine but currently the path is ~/Pictures/bros.jpg.
What code i should place in custom binding ?

推荐答案

使用http处理程序读取图像文件并显示图像。唯一的区别是以前你曾经给过一个路径,但这不会由一段代码完成。点击此链接从SQL数据库显示图像 - 简单易用方式 [ ^ ]
Read the image file using http handler and display the image. The only difference is previously you used to give a path, but not this will be done by a piece of code. Check this link Display images from a SQL database - the easy way[^]


这篇关于图像数据绑定在datalist中的自定义绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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