Hi,

I've currently got a gridView which selects data from my table, it also has the URL of an image in one of the columns.

I want an imageField which can then display the image from the URL thats provided in the image column.

My datagrid:

[img]http://i41.tinypic.com/25ivst2.jpg[/img]

My code for the DataGrid:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" Height="234px" Width="459px" AllowPaging="True" 
                              AllowSorting="True" onselectedindexchanged="GridView1_SelectedIndexChanged">
            <Columns>
             <asp:BoundField DataField="imageSrc" HeaderText="imageSrc"
                    SortExpression="imageSrc" />
            <asp:BoundField DataField="CoffeeName" HeaderText="Coffee"
            SortExpression="CoffeeName" />
                <asp:BoundField DataField="CoffeeStrength" HeaderText="Strength" 
                    SortExpression="CoffeeStrength" />
                <asp:BoundField DataField="CoffeeGrind" HeaderText="Grind" 
                    SortExpression="CoffeeGrind" />
                <asp:BoundField DataField="StockLevel" HeaderText="Stock" 
                    SortExpression="StockLevel" />
                    
                    <asp:TemplateField HeaderText="Icon">
                        <ItemTemplate>
                        <asp:Image ID="Image2" runat="server" ImageUrl='<%# Eval("imageSrc") %>' AlternateText='<%# Eval("imageSrc") %>' />
                        </ItemTemplate>
                        </asp:TemplateField>

            </Columns>
        </asp:GridView>

As you can see the URL displays perfectly however I now want that URL image to be displayed in the GridView (icon column) as an actual Image.

Thank you.

Hey,

i've read through that article but still having difficulty, it just writes the source of the image rather than the image itself?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.