Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<asp:DataList ID="DataList1" runat="server">
     <ItemTemplate>
         <asp:Image  ImageUrl='<%#DataBinder.Eval("imager")  %>' ID="Image1" runat="server" />
 </ItemTemplate>
    </asp:DataList>


I try above code to display image but not working
help me
Posted
Updated 12-Mar-11 4:10am
v2

You are some thing missing while using DataBinder.Eval(object,String) you need to know it requires minimum two parameter one is Object and other is string value. you can know more about it from there-[Data Binding Expressions for Web Forms Pages][^] to know how to use Databinder.Eval to bind data [Ex Image]
<asp:image imageurl="<%#DataBinder.Eval(Container.DataItem,"imager")  %>" id="Image1" runat="server" xmlns:asp="#unknown" />

or
<asp:Image id="myImage" runat="server"
   ImageUrl='<%# DataBinder.Eval ( Container, "DataItem.ProductImage",
      "~/shared/images/{0}" ) %>'>
 
Share this answer
 
This will help you
Image Handling In ASP.NET[^]
 
Share this answer
 
ImageUrl must be pointing at your image virtual path. What is the value of DataBinder.Eval("imager")? Do you need to append a path perhaps?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900