Currently in my webpage i load images to the ListView object as follows...
<ContentTemplate>
<asp:ListView ID="ListView1" runat="server">
<layouttemplate>
<asp:PlaceHolder id="itemPlaceholder" runat="server" />
</layouttemplate>
<ItemTemplate>
<td>
<asp:Image ID="Image1" runat="server"
ImageUrl = '<%# DataBinder.Eval(Container.DataItem, "Image") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</ContentTemplate>
Now, i would like to use a combination of a Generic Handler and the ListView object to serve the images into the ListView
...the generic handler call is like
~/Handlers/Image.ashx?img=
How could i combine both above to serve images?
I tried something like the following but it is not correct
<asp:Image ID="Image1" runat="server"
ImageUrl = ~/Handlers/Image.ashx?img= & '<%# DataBinder.Eval(Container.DataItem, "Image") %>' />
So what is the correct way?
Yes that is the correct way. Your syntax for binding the ImageUrl not correct though. Try this one:
You might also use the ItemDataBound event to use code like this: