On Oct 2, 2:24 am, gh <g...@att.net> wrote:
> George Ter-Saakov wrote:
> > Do not try to make everything as a Server control. Usually image shouldnot
> > 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 arenot
> > using them as a server controls.
>
> > George.
>
> >>Do you by chance know how to make an image a hyper link? Below is the code
> >>I have.
>
> >> <asp:Image id="Image1" runat="server" height="125px" width="125px"
> >>imagealign="Left" imageurl='<%# "images/" +
> >>DataBinder.Eval(Container.DataItem,
> >>"PHOTOID")%>'></asp:image> PhotoID:
>
> >>TIA
>
> 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:HyperLin*k>
>
> TIA- Hide quoted text -
>
> - Show quoted text -
An image with a hyper link on html page can be created using a mix of
<a> and <img> tags. In ASP.NET, the <img> tag is rendered through the
Image control and <a> through the HyperLink. Note, neither <img> nor
Image control has a destination link property (navigateurl in your
case).
There is another control, named ImageButton, take a look, maybe this
helps
http://samples.gotdotnet.com/quickst..._imagebut.aspx
..NET server control cannot work without runat=server.