RadBinaryImage1 not showing Image for byte[] DataValue

2 posts, 0 answers
  1. Jai
    Jai avatar
    34 posts
    Member since:
    May 2011

    Posted 26 Jul 2011 Link to this post


    I am facing a problem with RadBinaryImage1. I have one byte[] object with some data and i am assigning it to RadBinaryImage1.DataValue and then RadBinaryImage1.DataBind() but not showing any Image in RadBinaryImage1.

    RadBinaryImage1.DataValue = Image;
    here the Image object is byte[] type. this thing i am doing in one user control.

    and I am calling this user Control under RadDataGrid on <EditFormSettings>.

    Can anyone tell me What i am doing wrong here ?

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 05 Nov 2011 Link to this post


    Used below method if you store your image as binary in DB.
    <telerik:RadBinaryImage ID="image" runat="server" DataValue='<%# Eval("Picture") == null ? null : ((Binary) Eval("Picture")).ToArray() %>'
                                                Width="95px" Height="115px" ResizeMode="None"
                                                AlternateText='<%#Eval("FirstName", "Photo of {0}") %>' Visible='<%# Eval("Picture") == null ? false : true %>' />


    Your image stored physically then used below method.

      FileStream fs = new FileStream("yourfilePath", FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fs);
            byte[] image = br.ReadBytes((int)fs.Length);
    RadBinaryImage.DataValue = image;

    Jayesh Goyani
  3. DevCraft R3 2016 release webinar banner
Back to Top