This is a migrated thread and some comments may be shown as answers.

RadBinaryImage1 not showing Image for byte[] DataValue

1 Answer 157 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Jai
Top achievements
Rank 1
Jai asked on 26 Jul 2011, 01:28 PM
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

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 05 Nov 2011, 11:58 AM
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
Tags
BinaryImage
Asked by
Jai
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or