Click here to Skip to main content
15,880,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
>> Tabel<<<<
TableName: D_Image

columns
SQL
ImageID int (Prmry key)
PhotoName nvarchar(256)
Photo nvarchar (256)


>>>>>MY EDIT TEMPLATE IS<<<<<<<

ASP.NET
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
<asp:TextBox ID="PhotoNameTextBox" runat="server" Text='<%# BindItem.PhotoName %>' />
 
<asp:Image ID="Image1" runat="server" ImageUrl='<%# BindItem.Photo %>' Width="135" />


<asp:FileUpload ID="FileUpload1" runat="server" />


>>> CODE BEHIND IS<<<<br mode="hold" />

VB
Protected Sub EntityDataSource1_Updating(sender As Object, e As EntityDataSourceChangingEventArgs) Handles EntityDataSource1.Updating
Dim ImageID As Integer = Convert.ToInt32(Request.QueryString.Get("ImageID") )
Dim D_Image As D_Image = CType(e.Entity, D_Image)
Dim FileUpload1 As FileUpload = CType(Listview1.InsertItem.FindControl("FileUpload 1"), FileUpload)
Dim VirtualFolder As String = "~/Pics1/"
Dim PhysicalFolder As String = Server.MapPath(VirtualFolder)
Dim Extension As String = System.IO.Path.GetExtension(FileUpload1.FileName)
Dim filename As String = Guid.NewGuid.ToString
Dim Path As String = VirtualFolder + filename + Extension
FileUpload1.SaveAs(System.IO.Path.Combine(Physical Folder, filename + Extension))
D_Image.Photo = Path.ToString
Label1.Text = D_Image.Photo
End Sub
Posted
Updated 19-Aug-14 17:29pm
v2
Comments
Mayank Vashishtha 19-Aug-14 23:46pm    
What do you mean by Edit Image? What are you tring to do? Clarify more.
Vasid Qureshi 20-Aug-14 10:18am    
Edit image means i have added an image to my database now instead of this image i want to replace that with another one.
please do me a favour i seriously stuck over this since 3days. :'(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900