0

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.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by dawsonz
0

Hey,

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.