I use to render data using EntityDataSource, and I use to store customer image as byte in database, the problem is how can I convert that byte to base64 on .aspx page itself to use it as image src, is there any way to do this in javascript.
Asked
Active
Viewed 1,983 times
1 Answers
0
Why do you need to convert a byte[] to base64 string? This won't allow you showing the image on the page. You could write a generic handler (.ashx) that will query the database, fetch the image bytes and write them to the response stream. Then you simply instruct your image src
property to this generic handler.

Darin Dimitrov
- 1,023,142
- 271
- 3,287
- 2,928
-
for your Information we can directly assign bytes as a Image src... http://stackoverflow.com/questions/3431095/how-to-display-an-image-stored-in-bytes-on-a-page – BreakHead Aug 23 '10 at 08:17
-
2@Qutbuddin Kamaal, for your information this doesn't work on all browsers like IE7 and lower. Another drawback is that this will make your pages very large (Base64 encoded images are roughly 33% larger than their binary equivalent) and images won't be cached by the client browser. – Darin Dimitrov Aug 23 '10 at 08:19
-
Thanx Darin for your Information..dats why I luv dis site... :) – BreakHead Aug 23 '10 at 08:33