FPT Aptech
[Link] 4.5 -Lab 3
[Link] 4.5 Assignment Guide
Introduction : Developing a [Link] application using Model Binder & Model Validation Requirement : Visual Studio .Net 2012 (.Net Framework 4.5 ) In SQL Server 2008 / 2012 , create a database named Manager and create a table named Books as the following :
Step 1 : Create [Link] Application 1.1 From menu File|New Web Site, In Project Type | Visual C# & Templates | [Link] Empty Web Site and named MyWebApp , add App_Code folder. 1.2 Right-click on MyWebApp | Add New Item | [Link] Entity Data Model , named [Link] as the below figure .
kiemhh@[Link]
Page:1
FPT Aptech -
[Link] 4.5 -Lab 3
Microsoft Visual Studio dialog showed , click Yes to add model into App_Code .
In Entity Data Model Wizard dialog , select Generate from database , click Next | New Connection , and configure as the below figures :
kiemhh@[Link]
Page:2
FPT Aptech
[Link] 4.5 -Lab 3
kiemhh@[Link]
Page:3
FPT Aptech
[Link] 4.5 -Lab 3
kiemhh@[Link]
Page:4
FPT Aptech
[Link] 4.5 -Lab 3
Step 2 :Create a [Link] page 2.1 Add new a [Link] [Link] with interface as the below table: named user
Control Type TextBox TextBox TextBox Validation Summary ID ID ID
Properties/ Event txtBookID txtBookTitle txtBookPrice Red
Value
ForeColor HeaderText ID ItemType
Please check the following errors: fvProductDetail Book Insert fvProductDetail_InsertBook Reference to HTML Code for FormView gvBookList BookID True True gvBookList_GetBooks gvBookList_UpdateBook gvBookList_DeleteBook
FormView
DefaultMode InsertMethod Design for InsertItemTemplate ID DataKeyNames AutoGenerateDeleteButton
GridView
AutoGenerateEditButton SelectMethod UpdateMethod DeleteMethod
kiemhh@[Link]
Page:5
FPT Aptech HTML Code for FormView
[Link] 4.5 -Lab 3
2.2 Right-click on App_Code | Add | Class , named [Link] and writes code as the following:
kiemhh@[Link]
Page:6
FPT Aptech
[Link] 4.5 -Lab 3
2.3 Double click on the [Link] page and writes code for [Link] file as the following :
Step 3 : Run MyWebApp application On the MyWebApp project , select MaintainBooks .aspx , right-click | View in Browser ,
and test functions as the below figure .
kiemhh@[Link]
Page:7
FPT Aptech
[Link] 4.5 -Lab 3
kiemhh@[Link]
Page:8