Akhter HUssain

Akhter HUssain

  • 713
  • 1.3k
  • 103.2k

Unable to cast object of type System.String to type System.B

Sep 23 2019 6:30 AM
I am passing data from one page to another page, but one image this exception is being raised that
 
Unable to cast object of type System.String to type System.Byte.
 
here is my second page html of image..
  1. <asp:TemplateField HeaderText="Image">  
  2. <ItemTemplate>  
  3. <%--<asp:Image ID="img" runat="server" ImageUrl='<%# Eval("Data").ToString() %>' Height="100px" Width="100px" />--%>  
  4. <asp:Image ID="Data" runat="server" Width="100px" Height="80px" ImageUrl='<%# "data:image/jpg;base64," + Convert.ToBase64String((byte[])Eval("Data")) %>' />  
  5. </ItemTemplate>

Answers (3)