my images are stored on server in folder "Albums".To access images the path is "/Albums/". I have tried this code but its not working.boxes for images appear on page load but after that immediately disappear.

<asp:ListView runat="server" ID="listView">
<ItemTemplate>
<asp:Image ID="img" ImageUrl= '<%# "/" + Eval("PictureLink")%>' width ="44" height ="45" runat="server" />
</ItemTemplate>
</asp:ListView>

Recommended Answers

All 2 Replies

You can use format part of Eval().

ImageUrl='<%# Eval("PictureLink","~/Albums/{0}")%>'

Hi eesha.ebaad,

I can understand how you feel when you find your image in your specified location but can't see in your page.
To fix this you might need a fully qualified URL to the specified resource suitable for use on the browser i.e.ResolveClientURL("~Your Link")

So, your code should be something like this

<asp:Image ID="img" ImageUrl= '<%# ResolveClientURL("~/" + Eval("PictureLink")) %>' width ="44" height ="45" runat="server" />

Hope this helps :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.