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

BinaryImage issue with Null Values/Also no image displays

1 Answer 131 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Dwayne Starkey
Top achievements
Rank 1
Dwayne Starkey asked on 30 Nov 2009, 05:36 PM
I have read the other posts talking about null values for binaryImages. None seem to work since I am programming in VB.
If my image from the DB is null I get the following:
Unable to cast object of type 'System.DBNull' to type 'System.Byte[]' “

If I do end up having an image, no image displays. I am retrieving the information from a stored procedure. All other information comes through fine except the image.
Any help would be appreciated.

 

<telerik:RadListView ID="RadListSearchresults" runat="server" ItemPlaceholderID="PlaceHolder1" AllowPaging="true" Skin="Default" PageSize="8" >

 

 

<LayoutTemplate>

 

 

<div >

 

 

<asp:Panel ID="SResults" runat="server">

 

 

<div>

 

 

<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

 

 

</div>

 

 

<br />

 

 

</asp:Panel>

 

 

</div>

 

 

</LayoutTemplate>

 

 

<ItemTemplate>

 

 

<fieldset style="float: left; width: 280px;">

 

 

<legend>Item:

 

<%

#Eval("Nomenclature")%>

 

 

</legend>

 

 

<table cellpadding="0" cellspacing="0">

 

 

<tr>

 

 

<td>

 

 

<table cellpadding="0" cellspacing="0">

 

 

<tr>

 

 

<td style="width: 25%">

 

NSN:

 

</td>

 

 

<td style="width: 50%">

 

<%

#Eval("NSN")%>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

MCN:

 

</td>

 

 

<td>

 

<%

#Eval("MCN")%>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

Slamis:

 

</td>

 

 

<td>

 

<%

#Eval("Slamis")%>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

LIN:

 

</td>

 

 

<td>

 

<%

#Eval("LIN")%>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<asp:Button ID="Button1" runat="server" Text="Edit" /></td>

 

 

 

</tr>

 

 

</table>

 

 

</td>

 

 

<td align="right" style="width: 25%;padding-left: 10px;">

 

 

<telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" AlternateText="Photo Not Found" DataValue='<%#Eval("Img") %>'

 

 

ToolTip='<%#Eval("ImgName", "Photo of {0}") %>' Width="90px" Height="110px" AutoAdjustImageControlSize="false"

 

/>

 

</td>

 

 

</tr>

 

 

</table>

 

 

</fieldset>

 

 

</ItemTemplate>

 

 

</telerik:RadListView>

 

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 01 Dec 2009, 10:35 AM
Hello Dwayne,

Regarding the mentioned error: I tried replicating it in the attached sample but to no avail. Could you please check it out and let me know what differs in your case?

As it is to the image problem: Please make sure you have registered the http handler of the RadBinaryImage control in the web.config file as shown below and described in this help topic:

<httpHandlers>
      <remove path="*.asmx" verb="*" />
      ......................................................
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
</httpHandlers>

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
BinaryImage
Asked by
Dwayne Starkey
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or