When I test inserting a new photo album, the record gets added to the table in the database just fine. And I see the ID in the table. But PhotoAlbumId in the query string always shows 0.
http://localhost:50829/ManagePhotoAlbum?PhotoAlbumId=0
Any ideas at what to look at?
Note: there is no space after the ? in the query string below. It just appears that way in this forum post. Don't know why.
Public Sub DetailsView1_InsertItem()
Dim photoAlbum As New PHOTOALBUM()
TryUpdateModel(photoAlbum)
If ModelState.IsValid Then
Using myEntities As New PlanetWroxEntities()
myEntities.PHOTOALBUMs.Add(photoAlbum)
myEntities.SaveChanges()
End Using
Response.Redirect(String.Format("ManagePhotoAlbum? PhotoAlbumId={0}", photoAlbum.ID.ToString()))
End If
End Sub