bind database image to ItemTemplate in .ascx

后端 未结 1 1818
孤街浪徒
孤街浪徒 2021-01-28 20:18

I am using dynamic ItemTemplate for ListView which populated from database.Here is how I do when I need to display string column \"Parametr\" (or some other datatypes):

1条回答
  •  再見小時候
    2021-01-28 20:39

    You could use an "inline image". The technique is described at for instance Base64 encoded images embedded in html (search for base64 image html for other resources).

    Get the base64-encoded string of the image data bytes, using Convert.ToBase64String for instance, and then use and append the image data.

    So you can bind it using something like this

    
    

    Of course, this is only recommended for small images. Also note that you should change "gif" to the actual format of your image.

    0 讨论(0)
提交回复
热议问题