Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ASP.NET
Line 54: <itemtemplate>
Line 55: <asp:Image ID="Image1" runat="server" ImageUrl='<%# "data:b/jpg;base64," + Convert.ToBase64String((byte[])Eval("a")) %>' Height="150px" Width="150px"/>
Line 56: </itemtemplate>
Posted
Updated 7-Oct-15 3:04am
v2
Comments
Member 12039969 7-Oct-15 9:00am    
there i convert it as base64, but also it gives a same error

It seems that Eval("a") (whatever it is) returns an Int32 value...You can not cast an int to a byte array - you need to convert it...
Try this:
C#
BitConverter.GetBytes(Eval("a"))


https://msdn.microsoft.com/en-us/library/de8fssa4(v=vs.110).aspx[^]
 
Share this answer
 
You may use the BitConverter class[^].
 
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