George said:
Do not try to make everything as a Server control. Usually image should not
be a server control.
Do something like this
<a href="images/<%# DataBinder.Eval(Container.DataItem, "PHOTOID")%>" >
<img src="images/<%# DataBinder.Eval(Container.DataItem, "PHOTOID")%>"
height="125px" width="125px" >
</a>
PS: Nothing prevents you from making it as a server control and use
<asp:Image> <asp:Link>. You will just consume more resources if you are not
using them as a server controls.
George.
George:
When the image is clicked I have a value of anther field I need to pass
in the url. I use the code below in a link to do this and it works
great. Can this be done without using runat server? Anyway the
<asp:HyperLink runat="server" navigateurl='<%#"selphotos.aspx?id="+
DataBinder.Eval(Container.DataItem, "ExternalId").ToString()%>'
id="Hyperlink1"><%#DataBinder.Eval(Container.DataItem,
"PrjID")%></asp:HyperLink>
What I was trying was to use the code below with the image, but it
doesn' t act as a link, when clicked.
<asp:HyperLink><asp:Image id="Image1" runat="server" height="125px"
width="125px"
imagealign="Left" runat="server" navigateurl='<%#"selphotos.aspx?id="+
DataBinder.Eval(Container.DataItem, "ExternalId").ToString()%>'
id="Hyperlink1"><%# "images/" +
DataBinder.Eval(Container.DataItem,"PHOTOID")%>'></asp:image></asp:HyperLink>
TIA