Why image is not showing in repeater

  • Thread starter Thread starter Deep
  • Start date Start date
D

Deep

dear friends

I am showing images in repeater this way. why it is not showing.

<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table border="1">
<tr>
<td>Image Title</td>
<td>Image Name</td>
<td>Image</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#DataBinder.Eval(Container.DataItem,
"imageTitle" )%></td>
<td><%#DataBinder.Eval(Container.DataItem, "imageName")
%></td>
<td><asp:Image ID="Diamond" runat="server"
AlternateText="List Item Separator" ImageUrl='~/General/images/<
%#DataBinder.Eval(Container.DataItem, "imageName")%>' /></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

Thanks in advance
 
dear friends

I am showing images in repeater this way. why it is not showing.

  <asp:Repeater ID="Repeater1" runat="server">
                <HeaderTemplate>
                <table border="1">
                <tr>
                <td>Image Title</td>
                <td>Image Name</td>
                <td>Image</td>
                </tr>
                </HeaderTemplate>
                <ItemTemplate>
                <tr>
                <td><%#DataBinder.Eval(Container.DataItem,
"imageTitle" )%></td>
                <td><%#DataBinder.Eval(Container.DataItem, "imageName")
%></td>
                <td><asp:Image ID="Diamond" runat="server"
AlternateText="List Item Separator" ImageUrl='~/General/images/<
%#DataBinder.Eval(Container.DataItem, "imageName")%>' /></td>
                </tr>
                </ItemTemplate>
                <FooterTemplate>
                </table>
                </FooterTemplate>
                </asp:Repeater>

Thanks in advance

ImageUrl='~/General/images/<
%#DataBinder.Eval(Container.DataItem, "imageName")%>'

You can't mix the coding it that way. Try to use

ImageUrl='<%# "/General/images/" + DataBinder.Eval(Container.DataItem,
"imageName")%>'

change "+" to "&" if it's on vb

Hope this helps
 
Back
Top