C
Chris White
I'm trying to put a dynamic image inside a Data Repeater.
<asp:Repeater id="repModels" runat="server">
<ItemTemplate>
<asp:Image id="Image1" runat="server" ImageUrl="images/cars/small/<%#
Databinder.Eval(Container.DataItem, "Picture") %>">
</asp:Image>
</ItemTemplate>
</asp:Repeater>
This was giving me Parser Error Message: The server tag is not well formed
After doing some searching, I replaced the outer double quotes with single
quotes
<asp:Repeater id="repModels" runat="server">
<ItemTemplate>
<asp:Image id="Image1" runat="server" ImageUrl='images/cars/small/<%#
Databinder.Eval(Container.DataItem, "Picture") %>'>
</asp:Image>
</ItemTemplate>
</asp:Repeater>
This doesn't work, the Databinder.Eval does not even get parsed.
And why does the above Not work and the code below does?
<asp:Repeater id="repModels" runat="server">
<ItemTemplate>
<asp:HyperLink id="Hyperlink1" NavigateUrl='' Text='<%#
Databinder.Eval(Container.DataItem, "Picture") %>' Runat="server">
</asp:HyperLink>
</ItemTemplate>
</asp:Repeater>
And finally, is there any real benefit using an asp:Image tag instead of an
img tag?
<asp:Repeater id="repModels" runat="server">
<ItemTemplate>
<asp:Image id="Image1" runat="server" ImageUrl="images/cars/small/<%#
Databinder.Eval(Container.DataItem, "Picture") %>">
</asp:Image>
</ItemTemplate>
</asp:Repeater>
This was giving me Parser Error Message: The server tag is not well formed
After doing some searching, I replaced the outer double quotes with single
quotes
<asp:Repeater id="repModels" runat="server">
<ItemTemplate>
<asp:Image id="Image1" runat="server" ImageUrl='images/cars/small/<%#
Databinder.Eval(Container.DataItem, "Picture") %>'>
</asp:Image>
</ItemTemplate>
</asp:Repeater>
This doesn't work, the Databinder.Eval does not even get parsed.
And why does the above Not work and the code below does?
<asp:Repeater id="repModels" runat="server">
<ItemTemplate>
<asp:HyperLink id="Hyperlink1" NavigateUrl='' Text='<%#
Databinder.Eval(Container.DataItem, "Picture") %>' Runat="server">
</asp:HyperLink>
</ItemTemplate>
</asp:Repeater>
And finally, is there any real benefit using an asp:Image tag instead of an
img tag?