Gridview image gallery from binary data images

只谈情不闲聊 提交于 2020-01-06 01:59:45

问题


I have some images stored in varbinary fields. I want get them into a List object e.g List list

From here I can access each image byte array, e.g image.ImageData.

I need to bind them somehow as thumbnails to asp:gridview or something similar, is it possible with binary/byte[] images?


回答1:


I would try a slightly different approach.

Use an HTTPHandler to retrieve the images and bind the image src to the handler

Embed something like this in your gridview:

<img src="http://www.yoursite.com/imageHandler.ashx?id=4" />

See this StackOverflow answer for how to write the handler: Create PNG image with C# HttpHandler webservice



来源:https://stackoverflow.com/questions/1573287/gridview-image-gallery-from-binary-data-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!