Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > RadBinaryImage1 not showing Image for byte[] DataValue

Not answered RadBinaryImage1 not showing Image for byte[] DataValue

Feed from this thread
  • Jai avatar

    Posted on Jul 26, 2011 (permalink)

    Hi,

    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;
    RadBinaryImage1.DataBind();
    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 ?

    Thanks,
    --Jai

    Reply

  • Posted on Nov 5, 2011 (permalink)

    Hello,

    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 %>' />

    or

    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);
            br.Close();
            fs.Close();
     
    RadBinaryImage.DataValue = image;


    Thanks,
    Jayesh Goyani

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > RadBinaryImage1 not showing Image for byte[] DataValue