-1

I am trying to display images from the database but it's not working.Can anyone help me out please help is appreciated. The result is what I get from this code.

<ItemTemplate>
    <li class="last">
        <a href="#"> <img src="../<%#Eval(" Image") %>" /></a>
    </li>
</ItemTemplate>

table with content:

Tommy
  • 39,592
  • 10
  • 90
  • 121
khans
  • 41
  • 1
  • 8

1 Answers1

1

you cannot display byte[] in html tag html does not support this type so you have to convert it from byte[] to Base64String like

<a href="#"> <img src="data:image;base64,<%# Convert.ToBase64String((byte[])Eval("Image")) %>" /></a>
Usman
  • 4,615
  • 2
  • 17
  • 33