Hi Imar, thank you very much for all the prompt replies. I am stuck at pg508 Creating NewPhotoAlbum.aspx After following every steps, I got 2 errors, 1st is 'PhotoAlbums' is not a member of 'PlanetWroxEntities'. 2nd is 'Id' is not a member of 'PhotoAlbum'.
Below are my codes
Partial Class _NewPhotoAlbum
Inherits BasePage
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
End Class
<%@ Page Title="Create New Photo Album" Language="
VB" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="false" CodeFile="NewPhotoAlbum.aspx.
vb" Inherits="_NewPhotoAlbum" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<asp:DetailsView AutoGenerateRows="false" ID="DetailsView1" runat="server" DefaultMode="Insert" InsertMethod="DetailsView1_InsertItem" >
<Fields>
<asp:BoundField DataField="Name" HeaderText ="Name" />
<asp:CommandField ShowInsertButton ="True" ShowCancelButton ="false" />
</Fields>
</asp:DetailsView>
</asp:Content>
The PlanetWrox.edmx
https://s3.postimg.org/fj3h9dr8f/Scr...v_19_17_13.jpg
Please help. I am not sure why the errors occurred.