need help wit my datagrid's image
-
hi i am currently trying to use a gridview control to view data from the database. however one of the field is an image. the format i need to display is: id(labelbox),image(imagebox) but in the database my data is saved as id(text),pic(text,image name only like asd.jpg) however my image is all in the image folder... meaning i am trying to configure the imagebox in the gridview control to add the "image/" in front of the now image name.
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Pic") %>' Height="100px" Width="100px" />
this is what i got after changing the coulum to a template now the imageurl is like imageurl="asd.jpg" how ever i need it to be imageurl="image/asd.jpg" is there anyway to do this without on the below code?<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Pic") %>' Height="100px" Width="100px" />
-
hi i am currently trying to use a gridview control to view data from the database. however one of the field is an image. the format i need to display is: id(labelbox),image(imagebox) but in the database my data is saved as id(text),pic(text,image name only like asd.jpg) however my image is all in the image folder... meaning i am trying to configure the imagebox in the gridview control to add the "image/" in front of the now image name.
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Pic") %>' Height="100px" Width="100px" />
this is what i got after changing the coulum to a template now the imageurl is like imageurl="asd.jpg" how ever i need it to be imageurl="image/asd.jpg" is there anyway to do this without on the below code?<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Pic") %>' Height="100px" Width="100px" />
you need to do this in the eval statement (from memory):
ImageUrl='<%# "image/" + Eval("Pic") %>'