objectives
DESCRIPTION
1. Objectives. Define the terms used when talking about the Web Create a Web application Add controls to a Web form Start a Web application Use the validator controls. Objectives ( continued ). Include a list box on a Web form Determine whether a postback has occurred - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/1.jpg)
Creating Web Applications Using ASP.NET
Chapter Microsoft Visual Basic .NET: Reloaded
1
![Page 2: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/2.jpg)
2Microsoft Visual Basic .NET: Reloaded
Objectives
• Define the terms used when talking about the Web
• Create a Web application
• Add controls to a Web form
• Start a Web application
• Use the validator controls
![Page 3: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/3.jpg)
3Microsoft Visual Basic .NET: Reloaded
Objectives (continued)
• Include a list box on a Web form
• Determine whether a postback has occurred
• Include a DataGrid control on a Web form
![Page 4: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/4.jpg)
4Microsoft Visual Basic .NET: Reloaded
Web Terminology• Internet – world’s largest computer network• WWW (World Wide Web)
• Contains documents called web pages• Web pages are stored on Web Servers
• Web Server is a computer with software to serve up web pages in response to client requests (web browser)
![Page 5: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/5.jpg)
5Microsoft Visual Basic .NET: Reloaded
Web Terminology (continued)
• Static Web page displays information to the viewer
![Page 6: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/6.jpg)
6Microsoft Visual Basic .NET: Reloaded
Web Terminology (continued)
•HTML (Hypertext Markup Language) tags tell browser how to display information in page
![Page 7: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/7.jpg)
7Microsoft Visual Basic .NET: Reloaded
Web Terminology (continued)• URL (Uniform Resource Locater)
• Unique address that identifies location of a web page
• URL contains 4 parts:• http:// -- HTTP communication protocol
• Protocol is agreement between sender and receiver how data is sent and interpreted
• Host -- name of web server
• Path -- location of document on the web server
• Document name
![Page 8: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/8.jpg)
8Microsoft Visual Basic .NET: Reloaded
Web Terminology (continued)
• Dynamic Web page is interactive• It can accept information from the user and
also retrieve information for the user
![Page 9: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/9.jpg)
9Microsoft Visual Basic .NET: Reloaded
Web Terminology (continued)
• Use Web Form Designer Window to create web pages in Visual Basic .NET
![Page 10: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/10.jpg)
10Microsoft Visual Basic .NET: Reloaded
Web Terminology (continued)
• Use HTML tab to view html code automatically generated by the IDE
![Page 11: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/11.jpg)
11Microsoft Visual Basic .NET: Reloaded
Web Terminology (continued)
• .aspx file contains controls and html• .aspx.vb file contains program code
![Page 12: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/12.jpg)
12Microsoft Visual Basic .NET: Reloaded
HOW TO…
![Page 13: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/13.jpg)
13Microsoft Visual Basic .NET: Reloaded
Creating Web Applications
• Begin by starting a blank solution
![Page 14: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/14.jpg)
14Microsoft Visual Basic .NET: Reloaded
Creating Web Applications (continued)
• Add a ASP.NET Web Application project to the blank solution
![Page 15: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/15.jpg)
15Microsoft Visual Basic .NET: Reloaded
Creating Web Applications (continued)
• IDE with web form in design view
![Page 16: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/16.jpg)
16Microsoft Visual Basic .NET: Reloaded
Creating Web Applications (continued)
• Rename web pate (.aspx file) and set title property
![Page 17: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/17.jpg)
17Microsoft Visual Basic .NET: Reloaded
Adding Controls to a Web Form• Similar to adding controls to a Windows form
• Use tools contained in toolbox• Controls are not identical to Windows
counterparts• Have ID property rather than name property
![Page 18: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/18.jpg)
18Microsoft Visual Basic .NET: Reloaded
HOW TO…
![Page 19: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/19.jpg)
19Microsoft Visual Basic .NET: Reloaded
Adding Controls to a Web Form (continued)
![Page 20: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/20.jpg)
20Microsoft Visual Basic .NET: Reloaded
Adding Controls to a Web Form (continued)
![Page 21: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/21.jpg)
21Microsoft Visual Basic .NET: Reloaded
HOW TO…
![Page 22: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/22.jpg)
22Microsoft Visual Basic .NET: Reloaded
Starting a Web Application• Displays in external browser or in internal
browser built into Visual Studio .NET
![Page 23: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/23.jpg)
23Microsoft Visual Basic .NET: Reloaded
HOW TO…
![Page 24: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/24.jpg)
24Microsoft Visual Basic .NET: Reloaded
Using the Web Validator Tools
• RequiredField validator – verifies control contains data
• RangeValidator – verifies data falls within a set range of values
![Page 25: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/25.jpg)
25Microsoft Visual Basic .NET: Reloaded
HOW TO…
![Page 26: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/26.jpg)
26Microsoft Visual Basic .NET: Reloaded
Including a List Box on a Web Form
![Page 27: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/27.jpg)
27Microsoft Visual Basic .NET: Reloaded
Code for Stovall application
![Page 28: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/28.jpg)
28Microsoft Visual Basic .NET: Reloaded
Code for Stovall application (continued)
![Page 29: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/29.jpg)
29Microsoft Visual Basic .NET: Reloaded
Stovall application (continued)
• Page_Load event
• Occurs first time web form is displayed
• Also occurs when a postback action happens
• Postback refers to client requesting data from server
• IsPostBack property indicates if form is being displayed for first time or as a result of postback
![Page 30: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/30.jpg)
30Microsoft Visual Basic .NET: Reloaded
Stovall application (continued)
• Sample run of Stovall Application
![Page 31: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/31.jpg)
31Microsoft Visual Basic .NET: Reloaded
Including a DataGrid Control on a Web Form
![Page 32: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/32.jpg)
32Microsoft Visual Basic .NET: Reloaded
Including a DataGrid Control on a Web Form (continued)
• Web application for Fairview Industries connects to an Access database and displays data in datagrid
![Page 33: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/33.jpg)
33Microsoft Visual Basic .NET: Reloaded
Including a DataGrid Control on a Web Form (continued)
• Must call DataBind method to bind data to datagrid
![Page 34: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/34.jpg)
34Microsoft Visual Basic .NET: Reloaded
Customizing the Appearance of the Web DataGrid Control’s Data
• Click datagrid control and then click Auto Format link in properties list
![Page 35: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/35.jpg)
35Microsoft Visual Basic .NET: Reloaded
Customizing the Appearance of the Web DataGrid Control’s Data (continued)• Sample run of Fairview application with
Datagrid formatted using Professional 2 scheme
![Page 36: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/36.jpg)
36Microsoft Visual Basic .NET: Reloaded
Programming Example – Monthly Payment Calculator Application
• Fred Pierce has been shopping for a new car and has asked you to create an application that he can use to calculate and display his monthly car payment,
• using annual interest rates of 5%, 6%, 7%, 8%, 9%, and 10%, and
• terms of two, three, four, and five years
![Page 37: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/37.jpg)
37Microsoft Visual Basic .NET: Reloaded
TOE Chart
![Page 38: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/38.jpg)
38Microsoft Visual Basic .NET: Reloaded
User Interface
![Page 39: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/39.jpg)
39Microsoft Visual Basic .NET: Reloaded
Objects, Properties, and Settings
![Page 40: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/40.jpg)
40Microsoft Visual Basic .NET: Reloaded
Objects, Properties, and Settings (continued)
![Page 41: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/41.jpg)
41Microsoft Visual Basic .NET: Reloaded
Pseudocode
Page Load event procedure1. if it’s the first time the Web form is displayed
fill the lstRate control with datafill the lstTerm control with dataselect the first item in each list boxend if
btnCalc Click event procedure1. calculate the monthly payment2. display the monthly payment in lblPayment
![Page 42: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/42.jpg)
42Microsoft Visual Basic .NET: Reloaded
Code
![Page 43: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/43.jpg)
43Microsoft Visual Basic .NET: Reloaded
Code (continued)
![Page 44: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/44.jpg)
44Microsoft Visual Basic .NET: Reloaded
Summary
• The Web consists of Web pages that are stored on Web servers
• A client uses a browser to request a Web page from a Web server
• Web pages can be either static or dynamic (interactive)
• Static Web pages contain the information to display, as well as the HTML tags that control the appearance of the information• Static Web pages are not interactive
![Page 45: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/45.jpg)
45Microsoft Visual Basic .NET: Reloaded
Summary (continued)• Every Web page has a unique address, called
a URL, that indicates its location on the Web
• A URL consists of four parts: the protocol, the name of the Web server, the path to the Web page, and the name of the Web page
• A Web server can be a remote computer or your local machine
• To make your local machine a Web server, you must install and configure Microsoft IIS (Internet Information Services)
![Page 46: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/46.jpg)
46Microsoft Visual Basic .NET: Reloaded
Summary (continued)• A dynamic Web page requires two files: one
ending with .aspx and the other with .aspx.vb• The .aspx file contains the controls and HTML
that define the Web page’s interface, and the .aspx.vb file contains program code
• You add controls to a Web form in the same way that you add controls to a Windows form
• The Web Forms tab in toolbox contains Web tools• Web tools are similar but not identical to their
Windows counterparts
![Page 47: Objectives](https://reader036.vdocuments.site/reader036/viewer/2022062410/56815ce3550346895dcae726/html5/thumbnails/47.jpg)
47Microsoft Visual Basic .NET: Reloaded
Summary (continued)
• You test a Web application using a browser
• The Web Forms tab on the toolbox contains five validator tools
• Validator tools allow you to validate user input
• You can use a Web form’s IsPostBack method to determine whether the form is being displayed for the first time