InsideEdge
Instructor
Hi everyone,
I am retrieving images from a file and I’m using the database field that contains the image file’s name. The images are displayed in a DataGrid which has the image name bounded to the underlying database. The database finally gets the image from a folder called "images".
When I use a common HTML tag, the image works but an asp: hyperlink only shows the empty place holder or he image but not the image.
Here’s the code that works:
<IMG src='images/<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>'
Here’s the code that doesn’t work:
<asp:HyperLink id=HyperLink1 runat="server" CssClass="DepartmentUnselected" ImageUrl ='<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>' NavigateUrl="../login.aspx " ></asp:HyperLink>
I can click the place holder for the image and the link works perfectly. The only thing is there is no picture, just the placeholder. How can I make the second piece of code read my image from a bounded field in the DataGrid?
Please help.
I am retrieving images from a file and I’m using the database field that contains the image file’s name. The images are displayed in a DataGrid which has the image name bounded to the underlying database. The database finally gets the image from a folder called "images".
When I use a common HTML tag, the image works but an asp: hyperlink only shows the empty place holder or he image but not the image.
Here’s the code that works:
<IMG src='images/<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>'
Here’s the code that doesn’t work:
<asp:HyperLink id=HyperLink1 runat="server" CssClass="DepartmentUnselected" ImageUrl ='<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>' NavigateUrl="../login.aspx " ></asp:HyperLink>
I can click the place holder for the image and the link works perfectly. The only thing is there is no picture, just the placeholder. How can I make the second piece of code read my image from a bounded field in the DataGrid?
Please help.