Problem with coding

  • Thread starter Thread starter Bart Schelkens
  • Start date Start date
B

Bart Schelkens

Hi,

I have a datagrid on an asp-page.
I build my columns as templatecolumns.
One of my columns is supposed to display an image.
The name of the image is located in my database (i.e. T6000.jpg)
My images are all located in a folder called "Images".
Now when the column is created that should display the image, it doesn't
find the image.

Here is the piece of code that I use to display the column:

<asp:TemplateColumn HeaderText="Foto">
<ItemTemplate>
<asp:Image id="ImagePath" runat="server"
ImageUrl='Images/<%# DataBinder.Eval(Container.DataItem,
"ImageName") %>' />
</ItemTemplate>
</asp:TemplateColumn>

This is the result when i look at the source of the page :

src="/test/Polytools/Images/<%# DataBinder.Eval(Container.DataItem,
&quot;ImageName&quot;) %>"
 
try:

<asp:TemplateColumn HeaderText="Foto">
<ItemTemplate>
<img src='Images/<%#DataBinder.Eval(Container,"DataItem.ImageName")%>'
/>
</ItemTemplate>
</asp:TemplateColumn>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top