Click here to Skip to main content
15,916,293 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How can i display image from DataBase in listview?

my images as binary. my code:

C#
byte[] bytes = (byte[])t.Rows[0]["PicData"];
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
Image1.ImageUrl = "data:image/png;base64," + base64String;



ASP.net:
ASP.NET
<asp:Image ID="Image1" runat="server" Height="125px" Width="129px" ImageUrl='<%# (Eval ("PicData")) %>' /> 
Posted
Comments
Krunal Rohit 14-Oct-15 2:26am    
Any error occurred ?

-KR
Member 11411753 14-Oct-15 7:16am    
this code without listView is OK.
but when put in listView Image1 is error.

1 solution

this code without listView is OK.
but when put in listView Image1 is error.
 
Share this answer
 

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