gridview image column problem
- by jame
Work on vs05 C# asp.net .My SQL Syntax is :****
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Images]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Images]
GO
CREATE TABLE [dbo].[Images] (
[ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[ImageName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Image] [image] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
I want to show this Images table values in a grid view.....I do it ...but the image value can not show ....asp.net syntax for gridview is
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="ImageName" HeaderText="ImageName" />
<asp:TemplateField HeaderText="Image">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("Image") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Image") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
i write the below code on pageload event. i want images table values must shown when the page is load...
string strSQL = "Select * From Images";
DataTable dt = clsDB.getDataTable(strSQL);
this.GridView2.DataSource = dt;
this.GridView2.DataBind();
Why not i get the image on my image column of the gridview.....what's the problem is how to solve?