Link to home
Start Free TrialLog in
Avatar of David C
David CFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Gridview Template field not displaying image

Hi guys I have a gridview as below with a template field that displays an image based on the URL in the database. The database column is called pl.

The problem is if the URL is something like folder/folder/default.jpg it does not display it but if its folder/jpg it displays it??
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                    BorderColor="White" CssClass="mGrid" ShowHeader="False" BorderStyle="None">
                <Columns>
                <asp:BoundField DataField="fullname"/>
                <asp:BoundField DataField="fteam"/>
                <asp:BoundField DataField="city"/>
              <asp:TemplateField HeaderText="Picture ">
                    <ItemTemplate>
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("pl") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                </Columns>
                    <AlternatingRowStyle CssClass="alt" />
                </asp:GridView>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mrunal
Mrunal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David C

ASKER

Thanks whether I use ~/ or not it still does not display but as long as the picture is one folder deep it displays it
Avatar of David C

ASKER

@rashmi my original code is based on that. Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David C

ASKER

Thank you all it was my mistake the folder was thumbnails/DF5B8AA15DD8259F8912E35838310AF49E4A23AB and this was stored in an nvarchar(50) field that was automatically truncating the first bit!