0% found this document useful (0 votes)
59 views

ASP NET AssignmentGuide ModelValidation

This document provides instructions for developing an ASP.NET application using model binding and validation. It outlines 3 steps: 1) Create an ASP.NET application and Entity Data Model for a Books database table. 2) Create an ASP.NET page with controls to maintain books and add code files. 3) Run the application and test functions for inserting, updating, and deleting books from a gridview and formview.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

ASP NET AssignmentGuide ModelValidation

This document provides instructions for developing an ASP.NET application using model binding and validation. It outlines 3 steps: 1) Create an ASP.NET application and Entity Data Model for a Books database table. 2) Create an ASP.NET page with controls to maintain books and add code files. 3) Run the application and test functions for inserting, updating, and deleting books from a gridview and formview.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

FPT Aptech

ASP.NET 4.5 -Lab 3

ASP.NET 4.5 Assignment Guide


Introduction : Developing a ASP.NET 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 ASP.NET Application 1.1 From menu File|New Web Site, In Project Type | Visual C# & Templates | ASP.NET Empty Web Site and named MyWebApp , add App_Code folder. 1.2 Right-click on MyWebApp | Add New Item | ADO.NET Entity Data Model , named BookManager.edmx as the below figure .

[email protected]

Page:1

FPT Aptech -

ASP.NET 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 :

[email protected]

Page:2

FPT Aptech

ASP.NET 4.5 -Lab 3

[email protected]

Page:3

FPT Aptech

ASP.NET 4.5 -Lab 3

[email protected]

Page:4

FPT Aptech

ASP.NET 4.5 -Lab 3

Step 2 :Create a ASP.NET page 2.1 Add new a ASP.NET MaintainBooks.aspx 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

[email protected]

Page:5

FPT Aptech HTML Code for FormView

ASP.NET 4.5 -Lab 3

2.2 Right-click on App_Code | Add | Class , named Book.cs and writes code as the following:

[email protected]

Page:6

FPT Aptech

ASP.NET 4.5 -Lab 3

2.3 Double click on the MaintainBooks.aspx page and writes code for MaintainBooks.aspx.cs 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 .

[email protected]

Page:7

FPT Aptech

ASP.NET 4.5 -Lab 3

[email protected]

Page:8

You might also like