ImageID int (Prmry key) PhotoName nvarchar(256) Photo nvarchar (256)
<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" />
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
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)