We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Image column

Hi, is it possible to add an image column without using a template with a tag <img> and a relative path, but bounding directly the column to a property of type byte[] ?
Thanks 

Fabio

1 Reply

GV Gowthami V Syncfusion Team September 23, 2015 10:20 AM UTC

Hi Fabio,

Thanks for contacting Syncfusion support.

We could not render the image without <img> tag as it is necessary while using an image in Html.

For your requirement, we can encode your image byte array in base 64 as follows,

<script type="text/x-jsrender" id="columnTemplate">

         <img src='data:image/jpeg;base64,{{:Photo}}' />

</script>


@(Html.EJ().Grid<EmployeeView>("Grid")

. . . .

.Columns(col =>

        {

            col.HeaderText("Employee Image").Template(true).TemplateID("#columnTemplate").TextAlign(TextAlign.Center).Width(110).Add();

. . . .

. . . .

})

)


Please refer to the below link for more clarification,

http://sweetme.at/2013/10/18/six-four-base64-encode-and-embed-your-images-in-html-markdown-and-css-files/

Regards,
Gowthami V.


Loader.
Up arrow icon