Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends.

i have a problem with showing image that is converted to byte in the image control of asp.net.

i can read data from database but i can not show it in image control.
in fact i do not know what url i must use for this image.

thanks for your helping.
Posted
Comments
Manfred Rudolf Bihy 29-Dec-14 15:55pm    
Created link! <a href="..."> ... </a>
Cheers!
Shaun Blain 29-Dec-14 19:32pm    
If you provide some actual code, then we can try and help you.

Have you tried searching this in Google?
If I correctly understood your problem, there are so many solutions available on the Internet.

Check following links
http://www.aspsnippets.com/Articles/Display-Images-from-SQL-Server-Database-using-ASP.Net.aspx[^]

http://stackoverflow.com/questions/11284217/how-can-i-display-an-image-from-sql-server-using-asp-net[^]
 
Share this answer
 
Hi You can read the image data from database then you can convert it into stream using following code

C#
MemoryStream stream = new MemoryStream(YourImageData);
pictureBox1.Image = Image.FromStream(stream);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;


Thanks
 
Share this answer
 
Hi,

You can rather use like this:

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


In this case the byte data will be atomatically casted to image source data. For better understanding follow here.

Thanks
Sisir Patro
 
Share this answer
 
Comments
_Starbug_ 30-Dec-14 7:20am    
thanks for your answer. but what type of control i must use for image. where i must choose image(from HTML control or from Standard control). when i drag image from standard controls of toolbox this image does not have any src property but image from HTML has src property but i can not accept it in my codes. how can i do this? thanks.
[no name] 30-Dec-14 7:51am    
Rather you can use the HTML control anywhere.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900