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

Error While Binding the Images

1 Answer 21 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Syed Danish
Top achievements
Rank 1
Syed Danish asked on 23 Sep 2011, 03:33 PM
Hi All,

I am trying to fetch the images from database, if no images are available from the data base it is showing "DBNull' Error.

If I write the following code snippet with in the binding value '<%#Eval(Picture):null?Null:Eval("Picture")%> then all the images which even have the content are not getting displayed as required. Please do help me out of this problem.

Thanks,
Syed Danish

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Sep 2011, 06:31 PM
Hello,

please check with below code snippet.
DataValue='<%# Eval("Picture") == null ? null : ((Binary) Eval("Picture")).ToArray() %>'

or
ImageUrl  = '<%# Eval("Picture") == null ? null : Eval("Picture") %>'

let me know if any concern.

Thanks,
Jayesh Goyani
Tags
BinaryImage
Asked by
Syed Danish
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or