Hello
I wont to display Image in a GRIDVIEW throw an ImageField.
In the data base I stored the filepath in the field: Photo Nvarchar(100)
I create a folder in my projet directory named Images
So the Image row code in my grid view is like this:
<asp:imagefield dataimageurlfield="Photo"
dataimageurlformatstring="~\Images\{0}.jpg"
alternatetext="Employee Photo"
nulldisplaytext="No image on file."
headertext="Photo"
readonly="true"/>
I didn't put any relative code behind for this cause, and I think that's the cause of having always the value of the alternatetext. Can you help to correct this mistake please! I didn't find any document concerning this case in the internet for 3 day :( and I'm steal searching...
I also tried an other way but the Images don't appear. I also didn't use a code behin for this!
<asp:TemplateField HeaderText="Photo" SortExpression="Photo">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Photo") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" Height="75px" ImageUrl='<%# Eval("Photo") %>' />
</ItemTemplate>
</asp:TemplateField>