i have developed on grid view in that need to render images..

Jul 21 2010 5:08 AM
i have developed some code in that need to render image ..I have these images in my database.i m using code like the below ..
i m getting other column but not getting the image...

asp code.

<asp:GridView ID="GridView1" runat="server" Height="35px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                                            Style="margin-top: 0px" Width="170px" AutoGenerateColumns="False">
                                            <RowStyle Font-Size="Smaller" ForeColor="#475965" />
                                            <Columns>
                                                <asp:BoundField DataField="Ticker" HeaderText="Company Ticker" InsertVisible="False"
                                                    ReadOnly="True" SortExpression="Ticker" />
                                                <asp:TemplateField HeaderText="Company">
                                                    <ItemTemplate>
                                                        <asp:Image ID="Image1" runat="server" />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                            <HeaderStyle Font-Size="Smaller" ForeColor="#666666" />
                                            <EditRowStyle Font-Size="Smaller" />
                                        </asp:GridView>


c# code



System.Data.DataSet ds2 = new System.Data.DataSet();
                string cmText = "SELECT * FROM images WHERE TICKER=" + "'" + ticker + "'";
                SqlDataAdapter da1 = new SqlDataAdapter(cmText, con);
                da1.Fill(ds2);

                GridView1.DataSource = ds2;
                GridView1.DataBind();



Please suggest where i m going mistake...

Answers (1)