Chapters 15 - Web Application Development

Download Report

Transcript Chapters 15 - Web Application Development

COP2360 – C# Programming
Chapter 15 – Web Based Apps
Announcements

Assignment 5 will be a Class Project
–
–
–
We will be developing a basic registration and
transcript system based on the database we
looked at last week.
We will work together in developing this, but
everyone must have their own system (and can
make changes so that it looks like they want it to
look.)
We’ll start on the project next class.
Web Based Application Development

Uses a Client/Server approach to
applications
–
–
The Client for Web Based Applications is a Web
Browser running in a person’s PC
The Server is a centrally located computer that
receives requests from the client and sends page
information to be displayed on the browser.
Web Based Application Development

Is based on several standards that have grown over the years
–
HTML – Hyper Text Mark-Up Language

–
CSS – Cascading Style Sheets

–
A configuration file that helps ensure consistency in a web application
by defining fonts/colors and other attributes to be then applied in the
HTML
Server Side Scripting Languages



–
Not a true programming language – Instead it is the way the server
tells the client what to display within a web page
PHP (Used to be Personal Home Page – now PHP Hypertext
Preprocessor (Notice the recursion))
ASP – Active Server Pages
ASP.Net – Latest version using Dot Net Framework
Client Side Scripting Languages

javaScript
Web Based Application Development

This structure is very different from the
WebForm applications we have been playing
with
–
–
With a WebForm, the application is actively
running on the person’s PC, and can react to any
of the events we have looked at for each control
With a Web Application, although there can be
some client side processes that can react to some
events, most interaction is done by a “submission”
to the server, and the a “post back” to the client.
Static vs Dynamic Pages

Web Pages are usually lumped into two
types:
–
–
Static web pages are those pages that don’t
change. They are usually for showing the same
information over and over again
Dynamic Web Pages are pages that do change
based on what the user selects from an original
page. They usually involve some type of data
store that is included in the send of information to
the client.
Our Stinky Little Web Site



Let’s Take A Look
Let’s Look what happened when we type in
the URL (Uniform Resource Located…That
http:// thing)
Comment on Browsers
A pretty picture of Dynamic Web Site in
Operation
How Is Visual Studio Involved



Visual Studio allows one to develop Web
Applications that can be published to a web server
It let’s a programmer develop in either pure HTML or
ASP.Net or a combination of the two.
Remember, the code being created is running on a
Server, and sending back the information in HTML
format to the client (even if both the client and server
are on the same PC).
Let’s Make Our First Web Page

Basic Static Web Page using VS 2012
–
–
Start VS201
Select New Project


–
ASP.NET Empty Web Application
Call it Chapter15
Right Click on Project in Solution Explorer

Select New -> Web Page ->Name it Simple
Let’s Look at the HTML Code that was
generated
Let’s Make a Simple Dynamic Web
Page


Revisit our BMI calculator
Let’s Look at the code that is generated
–

And at the HTML that is returned
Let’s Go Through Similar Controls We
Learned in WINForms
–
Check Boxes, DropDownLists, Radio Buttons

Look at the neat lists for Check Boxes and Radio
Buttons
In Class Assignment

Develop a Web Page that will calculate the monthly mortgage payment
after the user enters the mortgage amount, number of year and
interest rate.
–
–




M = P [ i(1 + i)^n ] / [ (1 + i)^(n) – 1)]
Where M is the monthly payment. i = r/12. The same formula can be
expressed many different way, but this one avoids using negative
exponentials which confuse some calculators.
(http://www.fonerbooks.com/interest.htm)
Add a Check Box List so that the calculation is Weekly, Month or
Yearly
Add AutoPostBack to the Check Box List, so the calculation changes
without pressing the command button.
Make it pretty!!
Publish what you have done to your Web Site.
Web Pages and Connecting To A
Database

Can do the connection three ways
–
–
–
Using the OLEDB commands we went over last
week
Placing all the Database Commands into a Web
Server and accessing the server
Using ASP Data Source Controls


Let’s play with this way
Fairly straight forward (more so than Web Forms)