BinaryImage issue with Null Values/Also no image displays

2 posts, 0 answers
  1. Dwayne Starkey
    Dwayne Starkey avatar
    48 posts
    Member since:
    Aug 2009

    Posted 30 Nov 2009 Link to this post

    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>

     

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 01 Dec 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top