-3

my code:

<img src="<%dtpath.Rows[i][2].ToString();%>" 
     alt="" 
     style="width:173px;height:173px;margin:20px 0px 0px 35px;" 
     class="imagShadow" />

how to assign a value from data table to src in asp.net?

Kjartan
  • 18,591
  • 15
  • 71
  • 96
Soli B
  • 1

1 Answers1

0

You need to operate with base64 encoding, so assign it to src property of the image.

For this I can see a couple of solutions:

  1. You have image encoded in DB or on disk (with the path in DB), so you donwload it and convert it to base64 encoding via, say, How can you encode a string to Base64 in JavaScript? (there are also plenty of others)

  2. You prepare on the server for every image you already have corresponding file with base64 encoding, so simply download it and assign it to the image.

Community
  • 1
  • 1
Tigran
  • 61,654
  • 8
  • 86
  • 123