How to view a blob Image field into Imagefield in wijmo:C1GridView

Posted by: roberto_tomasi on 9 November 2020, 11:11 pm EST

    • Post Options:
    • Link

    Posted 9 November 2020, 11:11 pm EST

    Hi i must to view a blob Image field from Sql Server into Imagefield in wijmo:C1GridView

    any idea?

  • Posted 10 November 2020, 6:19 pm EST

    Hi Roberto,

    We are sorry for the inconvenience, we are unable to find a way to show the Image from Blob. Hence, we have forwarded this to the concerned team for further investigation with the internal tracking id C1WEB-27503.


    Manish Gupta

  • Posted 3 January 2021, 11:15 pm EST

    Hi Roberto,

    Please try to use the following code:

    Server-side: Create a method that converts to base 64 string from a byte array stored in DB

    // Convert by to string base 64
    protected string GetImageFromBlob(byte[] data)
        string base64String = Convert.ToBase64String(data);
        return String.Format("data:image/jpg;base64,{0}", base64String);

    Client-side: Call method in server-side to get the image source because image source must be a string

    <wijmo:C1TemplateField HeaderText="Image"> 
        <ItemStyle HorizontalAlign="Center" /> 
            <img src='<%# GetImageFromBlob((byte[])Eval("Image")) %>' alt=<%# Eval("Image") %> /> 

    Hope it helps!


    Manish Gupta

  • Posted 4 January 2021, 4:48 am EST

    Hi Manish

    Thank for your reply

    but i already solved

    in this way

    on grid row i added  
    in the columns
    <wijmo:C1BoundField DataField="Immagine" HeaderText="Immagine"  
               Visible="false"> </wijmo:C1BoundField>
    <wijmo:C1TemplateField >
                           <asp:Image ID="myIMG" runat="server" ImageUrl="" Width="240px" 
                                        Height="180px" />

    and in

     Protected Sub grdConsegna_RowDataBound(sender As Object, e As 
            ' cambio l'image url al controllo image del template da me definito
            If e.Row.RowType = DataControlRowType.DataRow Then
                  DirectCast(e.Row.Cells(5).FindControl("myIMG"), Image).ImageUrl = 
                                         "getImage.aspx?ID=" & e.Row.Cells(0).Text
            End If
        End Sub

    at the next time


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels