Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.

Not answered Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.

Feed from this thread
  • Canis Lupus avatar

    Posted on May 24, 2011 (permalink)

    This is how I formed my control

    <telerik:RadBinaryImage ID="imageThumbnail" runat="server" DataValue='<%# Eval("imageThumbData") %>' ImageUrl="~/imageLibrary/common/nopic.gif" Width="125" Height="125" />

    When I run the application I get an error saying

    Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.


    Isnt the imageURL suppose to handle this null case? How can I fix it?

    Thank you.

    Reply

  • Canis Lupus avatar

    Posted on May 24, 2011 (permalink)

    Solved it from other posts.

    <telerik:RadBinaryImage ID="imageThumbnail" runat="server" DataValue='<%#IIf(Typeof(Eval("imageThumbData")) is DBNull, Nothing, Eval("imageThumbData"))%>' ImageUrl="~/imageLibrary/common/loading.gif" Width="125" Height="125" />

    Above code works for me.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.
Related resources for "Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'."

ASP.NET Binary Image Features  |  Documentation  |  Demos  | Step-by-step Tutorial  ]