When I add a new photo album and pictures the images are not showing up in the new photo album page. When I checked the image URL in the database - its not importing them - I still see the null value.
I did go through the recommended steps in the website deployment chapter - adding Modify and Write/Read and Execute permissions to the 'Pics' Folder.
Here's code for Manage Photo Album
Code:
Protected Sub LinqDataSource1_Inserting1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceInsertEventArgs) Handles LinqDataSource1.Inserting
Dim myPicture As Picture = CType(e.NewObject, Picture)
myPicture.PhotoAlbumID = Convert.ToInt32(Request.QueryString.Get("PhotoAlbumID"))
Dim fileUpload1 As FileUpload = CType(ListView1.InsertItem.FindControl("FileUpload1"), FileUpload)
Dim virtualFolder As String = "~/Pics/"
Dim physicalfolder As String = Guid.NewGuid().ToString()
Dim extension As String = System.IO.Path.GetExtension(fileUpload1.FileName)
End Sub
'first convert the file in the fileupload file
'If the File upload file doesn't have anything that ends with .jpg then customer validator is false, cancel the fileupload
Protected Sub ListView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewInsertEventArgs) Handles ListView1.ItemInserting
Dim FileUpload1 As FileUpload = _
CType(ListView1.InsertItem.FindControl("FileUpload1"), FileUpload)
If Not FileUpload1.HasFile OrElse _
Not FileUpload1.FileName.ToLower().EndsWith(".jpg") Then
Dim CustomValidator1 As CustomValidator = _
CType(ListView1.InsertItem.FindControl("CustomValidator1"), CustomValidator)
CustomValidator1.IsValid = False
e.Cancel = True
End If
End Sub
Heres from the markup:
Inserting Item
Code:
<asp:Image ID="ImageUrl" runat="server" ImageURL='<%#Eval("ImageURL") %>'/><br />
Insert Item Template
<asp:FileUpload ID="FileUpload1" runat="server" />
???