动态显示图像 [英] display image dynamically

查看:72
本文介绍了动态显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人

请帮助实现一种逻辑

我在SQL Server数据库中有一个varbinary(max)
我正在通过datareader
获取它 如果假设我得到2条记录
那么我想动态创建2个链接按钮,并随时单击以显示特定图像.

Dear all

Please help to implement one logic

I have a varbinary(max) column in sql server database
and i am fetching it through datareader
If suppose i am getting 2 records
then i want to create 2 link buttons dynamically and on click of it anytime i want to display particular image

推荐答案

尝试此
进行图像控制
try this
take image control
<img  runat="server" id="image" />


并在后面的代码中执行此操作:


And in code behind do this:

image.src="data:image/png;base64,"+Convert.ToBase64String(imageBytes);



您也可以尝试
http://forums.asp.net/p/1379716/2913448.aspx



you can also try
http://forums.asp.net/p/1379716/2913448.aspx


1.从SQL获取记录
2.使用获取的记录计数迭代for循环
一个.创建ASP Link按钮控件
b.使用已加载的图像启用控件的OnClick事件

运行此逻辑后,您将解决问题.
1. Fetch records from SQL
2. Iterate a for loop with fetched records count
a. create ASP Link button control
b. enable OnClick event of control with loaded image

On running this logic, you will resolve the problem.


这篇关于动态显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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