By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,868 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

ASP.NET Image Upload... Guru needed

P: n/a
We're sooo close. When we load the page to upload the image, all of
the prms go through except the binary image data. Using SQL server
with the data type set to "image".

Please help!

Thanks-

John

<%@ Page Language="vb" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<Script Language="VB" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then
populatelist()
end if

End Sub

sub PopulateList()
Dim dt As DataTable
Dim dr As DataRow
dt = New DataTable

dt.Columns.Add(New DataColumn("id", GetType(Integer)))
dt.Columns.Add(New DataColumn("f_name", GetType(String)))
dt.Columns.Add(New DataColumn("l_name", GetType(String)))
dt.Columns.Add(New DataColumn("ima_type", GetType(String)))
dt.Columns.Add(New DataColumn("ima_length", GetType(Integer)))
dt.Columns.Add(New DataColumn("notoryes", GetType(String)))

'Server=216.51.xxx.x;UID=c2611;Pwd=managment;Datab ase=SQLDB988;
'Dim MyC7 As New SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Dim MyC7 As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim MySQL2 as string = "Select * from imaandname order by id desc"
MYC7.Open()
Dim cmd7 As SqlCommand = new sqlcommand(MySQL2,MYC7)
Dim Reader7 As SqlDataReader = cmd7.ExecuteReader()
while Reader7.read()
dr = dt.NewRow()

dr(0) = Reader7("id")
dr(1) = Reader7("f_name")
dr(2) = Reader7("l_name")
dr(3) = Reader7("ima_type")
dr(4) = Reader7("ima_length")

if Reader7("ima_length") = 0 then
dr(5) = "NoImage.png"
else
dr(5) = "readimage.aspx?id=" & Reader7("id")
end if

dt.Rows.Add(dr)

end while

Reader7.close()
MYC7.close()

dlCategories7.DataSource = new DataView(dt)
dlCategories7.DataBind

Response.Write("tst1")

End Sub

Public Sub Add_New_Picture(sender As Object, e As EventArgs)

Dim Size As Int64
Dim ImageType As String
Dim ImageStream As Stream

Size = c_pic.PostedFile.ContentLength
ImageType = c_pic.PostedFile.ContentType
ImageStream = c_pic.PostedFile.InputStream

if Size >100000 then
response.write("sorry your image exceed 0.1 MB, your uploads activate
a response end in script.<br>TRY AGAIN

with a smaller image.")
response.end
end if
' this is where its failing
Dim ImageContent(Size) As Byte
Dim intStatus As Integer
intStatus = ImageStream.Read(ImageContent, 0, Size)
Response.Write("Blowme")

Dim myConnection2 As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim myCommand2 As New SqlCommand("Insert into imaandname
(f_name,l_name,ima,ima_length,ima_type) VALUES

(@f_name,@l_name,@ima,@ima_length,@ima_type)", myConnection2)

Dim f_name As New SqlParameter("@f_name", SqlDbType.VarChar, 50)
f_name.Value = f_name_t.Text
myCommand2.Parameters.Add(f_name)

Dim l_name As New SqlParameter("@l_name", SqlDbType.VarChar, 50)
l_name.Value = l_name_t.Text
myCommand2.Parameters.Add(l_name)

Dim ima_type As New SqlParameter("@ima_type", SqlDbType.VarChar, 50)
if ImageType = "image/pjpeg" or ImageType = "image/gif" or ImageType =
"image/png" then
ima_type.Value = ImageType
else
ima_type.Value = ""
end if
myCommand2.Parameters.Add(ima_type)

Dim prmPersonImage As New SqlParameter("@ima", SqlDbType.Image)
prmPersonImage.Value = ImageContent
myCommand2.Parameters.Add(prmPersonImage)
Response.Write("tst2")

Dim ima_length As New SqlParameter("@ima_length", SqlDbType.int)
ima_length.Value = Size
myCommand2.Parameters.Add(ima_length)

Try
myConnection2.Open()
myCommand2.ExecuteNonQuery()
myConnection2.Close()
Response.Write("New image successfully added!")
Catch SQLexc As SqlException
Response.Write("Insert Failed. Error Details are: " &
SQLexc.ToString())
End Try

response.redirect("testy.aspx")

End Sub

Public Sub dlcategories7_Cancel(sender As Object, e As
DataGridCommandEventArgs)
dlcategories7.EditItemIndex = -1
populatelist()
End Sub

Public Sub dlcategories7_Edit(sender As Object, e As
DataGridCommandEventArgs)
dlcategories7.EditItemIndex = e.Item.ItemIndex
populatelist()
End Sub

Public Sub dlcategories7_Update(sender As Object, e As
DataGridCommandEventArgs)

Dim strConn As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")

Dim MyCommand As SqlCommand
Dim e_f_name As textbox = E.Item.cells(1).Controls(1)
Dim e_l_name As textbox = E.Item.cells(2).Controls(1)
Dim e_d_pic As object = E.Item.cells(5).Controls(1)

Dim intImageS As Int64
Dim strImageT As String
Dim ImageStream2 As Stream
intImageS = e_d_pic.PostedFile.ContentLength
strImageT = e_d_pic.PostedFile.ContentType
ImageStream2 = e_d_pic.PostedFile.InputStream

if intImageS >100000 then
response.write("sorry your image exceed 0.1 MB, your uploads activate
a response end in script.<br>TRY AGAIN

with a smaller image.")
response.end
end if

Dim ImageContent2(intImageS) As Byte
Dim intStatus2 As Integer
intStatus2 = ImageStream2.Read(ImageContent2, 0, intImageS)

Dim strEdit As String
if strImageT = "image/pjpeg" or strImageT = "image/gif" or strImageT
= "image/png" then
strEdit =" UPDATE imaandname SET" & _
" f_name =@f_name, l_name =@l_name, " & _
" ima_length=@ima_length, ima_type=@ima_type, " & _
" ima=@ima " & _
" WHERE iD = @ID"
else
strEdit =" UPDATE imaandname SET" & _
" f_name =@f_name, l_name =@l_name WHERE iD = @ID"
end if

MyCommand = New SqlCommand(strEdit, strconn)
MyCommand.Parameters.Add(New SQLParameter("@f_name", e_f_name.text))
MyCommand.Parameters.Add(New SQLParameter("@l_name", e_l_name.text))
MyCommand.Parameters.Add(New SQLParameter("@ima_length", intImageS ))
MyCommand.Parameters.Add(New SQLParameter("@ima_type", strImageT ))
MyCommand.Parameters.Add(New SQLParameter("@ima", ImageContent2 ))
MyCommand.Parameters.Add(New SQLParameter("@ID",
dlCategories7.DataKeys(CInt(E.Item.ItemIndex)) ))
strconn.Open()
MyCommand.ExecuteNonQuery()
dlcategories7.EditItemIndex = -1
strconn.close

populatelist()
end sub


Public Sub dlcategories7_Delete(sender As Object, e As
DataGridCommandEventArgs)

Dim conn As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim cmd As SqlCommand
conn.Open()
cmd = New SqlCommand()
Dim id As string
id = dlcategories7.DataKeys(CInt(E.Item.ItemIndex))
cmd.CommandText = "Delete from imaandname where id="&id
cmd.Connection = conn
cmd.ExecuteNonQuery()
cmd.connection.close
dlcategories7.EditItemIndex = -1
populatelist()

End Sub

Public Sub deleteonlyimage(sender As Object, e As EventArgs)
Dim strID As string =
dlcategories7.DataKeys(dlcategories7.SelectedItem. ItemIndex)
Dim conn37 As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim cmd37 As SqlCommand
conn37.Open()
cmd37 = New SqlCommand()
cmd37.CommandText = "update imaandname set ima_type=' ', ima_length=0
where id="&strID
cmd37.Connection = conn37
cmd37.ExecuteNonQuery()
cmd37.connection.close
response.write(id)
dlcategories7.EditItemIndex = -1
populatelist()
end sub
</SCRIPT>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Datagrid in-place editing w/images. Sagasnet
webstudio.</title>
</head>

<body>
<form runat="Server" ENCTYPE="multipart/form-data" METHOD="POST">
<table style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;">
<tr>
<td>
Upload New Image<br>
<INPUT TYPE="FILE" ID="c_pic" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;" runat="server"

/><br>
First Name.<br>
<asp:textbox Id="f_name_t" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;" runat="server"

/><br>
Last Name.<br>
<asp:textbox Id="l_name_t" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;" runat="server"

/><br>
<asp:Button Text="Upload New Picture" OnClick="Add_New_Picture"
style="border:1pt #4B4D67

solid;font-family:arial;font-size:8pt;" runat="server" />
</td>
</tr>
</table>
<hr>
<asp:datagrid
id="dlcategories7"
AutoGenerateColumns="False"
OnSelectedIndexChanged="deleteonlyimage"
OnDeleteCommand="dlCategories7_Delete"
OnEditCommand="dlCategories7_Edit"
OnCancelCommand="dlCategories7_Cancel"
OnUpdateCommand="dlCategories7_Update"
DataKeyField="id"
CellPadding="1"
Itemstyle-VerticalAlign="TOP"
font-name="Arial"
font-size="9pt"
HeaderStyle-BackColor="#aaaadd"
runat="server">
<Columns>
<asp:BoundColumn DataField="ID" readonly="true"
HeaderText="ID"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="FIRST NAME">
<ItemTemplate>
<asp:label id="f_name" text='<%# DataBinder.Eval(Container.DataItem,
"f_name") %>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:textbox width="70" ID="e_f_name" text='<%#
DataBinder.Eval(Container.DataItem, "f_name") %>'

style="border:1pt #4B4D67 solid;font-family:arial;font-size:8pt;"
runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="LAST NAME">
<ItemTemplate>
<asp:label id="l_name" text='<%# DataBinder.Eval(Container.DataItem,
"l_name") %>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:textbox width="70" ID="e_l_name" text='<%#
DataBinder.Eval(Container.DataItem, "l_name") %>'

style="border:1pt #4B4D67 solid;font-family:arial;font-size:8pt;"
runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="ima_length" readonly="true"
HeaderText="IMG-KB"></asp:BoundColumn>
<asp:BoundColumn DataField="ima_type" readonly="true"
HeaderText="IMG-TYPE"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="IMAGE">
<ItemTemplate>
<asp:Image Width="90" Height="60" ImageUrl='<%#
DataBinder.Eval(Container.DataItem, "Notoryes") %>'

Runat=server />
</ItemTemplate>
<EditItemTemplate>
<INPUT TYPE="FILE" width="70" ID="e_d_pic" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;"

runat="server" /><br>
Don't select,<br>to keep orginal image.<br>or<br>
<asp:linkbutton runat="server" text="Del only Image"
CommandName="Select" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:ButtonColumn HeaderText="DEL" Text="Delete" CommandName="Delete"
runat="server" />
<asp:editcommandcolumn HeaderText="EDIT" edittext="Edit"
canceltext="Cancel" updatetext="Update"

itemstyle-wrap="false"/>
</columns>
</asp:datagrid>
</form>

Upload blobs limited to 0.1 MB and gif, jpg and png.<br>
<a href='#' onClick='window.close()'>closewindow</a><br>
</body>
</html>
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
This article provides a working example for you:
http://steve.orr.net/content/asp200307so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"John Thompson" <jo***********@uiowa.edu> wrote in message
news:38**************************@posting.google.c om...
We're sooo close. When we load the page to upload the image, all of
the prms go through except the binary image data. Using SQL server
with the data type set to "image".

Please help!

Thanks-

John

<%@ Page Language="vb" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<Script Language="VB" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then
populatelist()
end if

End Sub

sub PopulateList()
Dim dt As DataTable
Dim dr As DataRow
dt = New DataTable

dt.Columns.Add(New DataColumn("id", GetType(Integer)))
dt.Columns.Add(New DataColumn("f_name", GetType(String)))
dt.Columns.Add(New DataColumn("l_name", GetType(String)))
dt.Columns.Add(New DataColumn("ima_type", GetType(String)))
dt.Columns.Add(New DataColumn("ima_length", GetType(Integer)))
dt.Columns.Add(New DataColumn("notoryes", GetType(String)))

'Server=216.51.xxx.x;UID=c2611;Pwd=managment;Datab ase=SQLDB988;
'Dim MyC7 As New SqlConnection(ConfigurationSettings.AppSettings("C onnectionString")) Dim MyC7 As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim MySQL2 as string = "Select * from imaandname order by id desc"
MYC7.Open()
Dim cmd7 As SqlCommand = new sqlcommand(MySQL2,MYC7)
Dim Reader7 As SqlDataReader = cmd7.ExecuteReader()
while Reader7.read()
dr = dt.NewRow()

dr(0) = Reader7("id")
dr(1) = Reader7("f_name")
dr(2) = Reader7("l_name")
dr(3) = Reader7("ima_type")
dr(4) = Reader7("ima_length")

if Reader7("ima_length") = 0 then
dr(5) = "NoImage.png"
else
dr(5) = "readimage.aspx?id=" & Reader7("id")
end if

dt.Rows.Add(dr)

end while

Reader7.close()
MYC7.close()

dlCategories7.DataSource = new DataView(dt)
dlCategories7.DataBind

Response.Write("tst1")

End Sub

Public Sub Add_New_Picture(sender As Object, e As EventArgs)

Dim Size As Int64
Dim ImageType As String
Dim ImageStream As Stream

Size = c_pic.PostedFile.ContentLength
ImageType = c_pic.PostedFile.ContentType
ImageStream = c_pic.PostedFile.InputStream

if Size >100000 then
response.write("sorry your image exceed 0.1 MB, your uploads activate
a response end in script.<br>TRY AGAIN

with a smaller image.")
response.end
end if
' this is where its failing
Dim ImageContent(Size) As Byte
Dim intStatus As Integer
intStatus = ImageStream.Read(ImageContent, 0, Size)
Response.Write("Blowme")

Dim myConnection2 As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim myCommand2 As New SqlCommand("Insert into imaandname
(f_name,l_name,ima,ima_length,ima_type) VALUES

(@f_name,@l_name,@ima,@ima_length,@ima_type)", myConnection2)

Dim f_name As New SqlParameter("@f_name", SqlDbType.VarChar, 50)
f_name.Value = f_name_t.Text
myCommand2.Parameters.Add(f_name)

Dim l_name As New SqlParameter("@l_name", SqlDbType.VarChar, 50)
l_name.Value = l_name_t.Text
myCommand2.Parameters.Add(l_name)

Dim ima_type As New SqlParameter("@ima_type", SqlDbType.VarChar, 50)
if ImageType = "image/pjpeg" or ImageType = "image/gif" or ImageType =
"image/png" then
ima_type.Value = ImageType
else
ima_type.Value = ""
end if
myCommand2.Parameters.Add(ima_type)

Dim prmPersonImage As New SqlParameter("@ima", SqlDbType.Image)
prmPersonImage.Value = ImageContent
myCommand2.Parameters.Add(prmPersonImage)
Response.Write("tst2")

Dim ima_length As New SqlParameter("@ima_length", SqlDbType.int)
ima_length.Value = Size
myCommand2.Parameters.Add(ima_length)

Try
myConnection2.Open()
myCommand2.ExecuteNonQuery()
myConnection2.Close()
Response.Write("New image successfully added!")
Catch SQLexc As SqlException
Response.Write("Insert Failed. Error Details are: " &
SQLexc.ToString())
End Try

response.redirect("testy.aspx")

End Sub

Public Sub dlcategories7_Cancel(sender As Object, e As
DataGridCommandEventArgs)
dlcategories7.EditItemIndex = -1
populatelist()
End Sub

Public Sub dlcategories7_Edit(sender As Object, e As
DataGridCommandEventArgs)
dlcategories7.EditItemIndex = e.Item.ItemIndex
populatelist()
End Sub

Public Sub dlcategories7_Update(sender As Object, e As
DataGridCommandEventArgs)

Dim strConn As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")

Dim MyCommand As SqlCommand
Dim e_f_name As textbox = E.Item.cells(1).Controls(1)
Dim e_l_name As textbox = E.Item.cells(2).Controls(1)
Dim e_d_pic As object = E.Item.cells(5).Controls(1)

Dim intImageS As Int64
Dim strImageT As String
Dim ImageStream2 As Stream
intImageS = e_d_pic.PostedFile.ContentLength
strImageT = e_d_pic.PostedFile.ContentType
ImageStream2 = e_d_pic.PostedFile.InputStream

if intImageS >100000 then
response.write("sorry your image exceed 0.1 MB, your uploads activate
a response end in script.<br>TRY AGAIN

with a smaller image.")
response.end
end if

Dim ImageContent2(intImageS) As Byte
Dim intStatus2 As Integer
intStatus2 = ImageStream2.Read(ImageContent2, 0, intImageS)

Dim strEdit As String
if strImageT = "image/pjpeg" or strImageT = "image/gif" or strImageT
= "image/png" then
strEdit =" UPDATE imaandname SET" & _
" f_name =@f_name, l_name =@l_name, " & _
" ima_length=@ima_length, ima_type=@ima_type, " & _
" ima=@ima " & _
" WHERE iD = @ID"
else
strEdit =" UPDATE imaandname SET" & _
" f_name =@f_name, l_name =@l_name WHERE iD = @ID"
end if

MyCommand = New SqlCommand(strEdit, strconn)
MyCommand.Parameters.Add(New SQLParameter("@f_name", e_f_name.text))
MyCommand.Parameters.Add(New SQLParameter("@l_name", e_l_name.text))
MyCommand.Parameters.Add(New SQLParameter("@ima_length", intImageS ))
MyCommand.Parameters.Add(New SQLParameter("@ima_type", strImageT ))
MyCommand.Parameters.Add(New SQLParameter("@ima", ImageContent2 ))
MyCommand.Parameters.Add(New SQLParameter("@ID",
dlCategories7.DataKeys(CInt(E.Item.ItemIndex)) ))
strconn.Open()
MyCommand.ExecuteNonQuery()
dlcategories7.EditItemIndex = -1
strconn.close

populatelist()
end sub


Public Sub dlcategories7_Delete(sender As Object, e As
DataGridCommandEventArgs)

Dim conn As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim cmd As SqlCommand
conn.Open()
cmd = New SqlCommand()
Dim id As string
id = dlcategories7.DataKeys(CInt(E.Item.ItemIndex))
cmd.CommandText = "Delete from imaandname where id="&id
cmd.Connection = conn
cmd.ExecuteNonQuery()
cmd.connection.close
dlcategories7.EditItemIndex = -1
populatelist()

End Sub

Public Sub deleteonlyimage(sender As Object, e As EventArgs)
Dim strID As string =
dlcategories7.DataKeys(dlcategories7.SelectedItem. ItemIndex)
Dim conn37 As New SqlConnection("Data Source=216.51.xxx.x;" _
& "Initial
Catalog=SQLDB988;User

Id=c2611;Password=management;" _
& "Connect
Timeout=15;Network Library=dbmssocn;")
Dim cmd37 As SqlCommand
conn37.Open()
cmd37 = New SqlCommand()
cmd37.CommandText = "update imaandname set ima_type=' ', ima_length=0
where id="&strID
cmd37.Connection = conn37
cmd37.ExecuteNonQuery()
cmd37.connection.close
response.write(id)
dlcategories7.EditItemIndex = -1
populatelist()
end sub
</SCRIPT>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Datagrid in-place editing w/images. Sagasnet
webstudio.</title>
</head>

<body>
<form runat="Server" ENCTYPE="multipart/form-data" METHOD="POST">
<table style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;">
<tr>
<td>
Upload New Image<br>
<INPUT TYPE="FILE" ID="c_pic" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;" runat="server"

/><br>
First Name.<br>
<asp:textbox Id="f_name_t" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;" runat="server"

/><br>
Last Name.<br>
<asp:textbox Id="l_name_t" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;" runat="server"

/><br>
<asp:Button Text="Upload New Picture" OnClick="Add_New_Picture"
style="border:1pt #4B4D67

solid;font-family:arial;font-size:8pt;" runat="server" />
</td>
</tr>
</table>
<hr>
<asp:datagrid
id="dlcategories7"
AutoGenerateColumns="False"
OnSelectedIndexChanged="deleteonlyimage"
OnDeleteCommand="dlCategories7_Delete"
OnEditCommand="dlCategories7_Edit"
OnCancelCommand="dlCategories7_Cancel"
OnUpdateCommand="dlCategories7_Update"
DataKeyField="id"
CellPadding="1"
Itemstyle-VerticalAlign="TOP"
font-name="Arial"
font-size="9pt"
HeaderStyle-BackColor="#aaaadd"
runat="server">
<Columns>
<asp:BoundColumn DataField="ID" readonly="true"
HeaderText="ID"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="FIRST NAME">
<ItemTemplate>
<asp:label id="f_name" text='<%# DataBinder.Eval(Container.DataItem,
"f_name") %>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:textbox width="70" ID="e_f_name" text='<%#
DataBinder.Eval(Container.DataItem, "f_name") %>'

style="border:1pt #4B4D67 solid;font-family:arial;font-size:8pt;"
runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="LAST NAME">
<ItemTemplate>
<asp:label id="l_name" text='<%# DataBinder.Eval(Container.DataItem,
"l_name") %>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:textbox width="70" ID="e_l_name" text='<%#
DataBinder.Eval(Container.DataItem, "l_name") %>'

style="border:1pt #4B4D67 solid;font-family:arial;font-size:8pt;"
runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="ima_length" readonly="true"
HeaderText="IMG-KB"></asp:BoundColumn>
<asp:BoundColumn DataField="ima_type" readonly="true"
HeaderText="IMG-TYPE"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="IMAGE">
<ItemTemplate>
<asp:Image Width="90" Height="60" ImageUrl='<%#
DataBinder.Eval(Container.DataItem, "Notoryes") %>'

Runat=server />
</ItemTemplate>
<EditItemTemplate>
<INPUT TYPE="FILE" width="70" ID="e_d_pic" style="border:1pt #4B4D67
solid;font-family:arial;font-size:8pt;"

runat="server" /><br>
Don't select,<br>to keep orginal image.<br>or<br>
<asp:linkbutton runat="server" text="Del only Image"
CommandName="Select" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:ButtonColumn HeaderText="DEL" Text="Delete" CommandName="Delete"
runat="server" />
<asp:editcommandcolumn HeaderText="EDIT" edittext="Edit"
canceltext="Cancel" updatetext="Update"

itemstyle-wrap="false"/>
</columns>
</asp:datagrid>
</form>

Upload blobs limited to 0.1 MB and gif, jpg and png.<br>
<a href='#' onClick='window.close()'>closewindow</a><br>
</body>
</html>

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.