Chapter 3: Develop A Multi-Page Web Application Liu, Jie Professor Department of Computer Science Western Oregon University.

Slides:



Advertisements
Similar presentations
Malek Kemmou Technology Architect, Application Platform Microsoft Middle East and Africa Overview of ASP.NET 2.0.
Advertisements

Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Working with ASP Pages. Slide 2 The Tag (1) Remember that most ASP.NET pages contain a single tag with the runat attribute set It’s possible to have multiple.
Cross-page Postbacks. Slide 2 Cross-Page Posting (Introduction 1) You can use a HyperLink control to create a link to another page Any Button control.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Chapter 1: An Introduction To ASP.NET Web Programming
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
11 ASP.NET Controls Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College Lecture 8: WebForms — Web-based.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
JavaScript & jQuery the missing manual Chapter 11
Session 5: Working with MySQL iNET Academy Open Source Web Development.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
IT533 Lectures Session Management in ASP.NET. Session Tracking 2 Personalization Personalization makes it possible for e-businesses to communicate effectively.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Working with GridView Control: Adding Columns. Adding Buttons to a Bound GridView: 1. Drag the WebProduct table from Data connection to a page 2. Demo.
11 Using ADO.NET II Textbook Chapter Getting Started Last class we started a simple example of using ADO.NET operations to access the Addresses.
1 CS 3870/CS 5870 Note04 Session Variables and Post Back.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
1 Chapter 12 – Web Applications 12.1 Programming for the Web, Part I 12.2 Programming for the Web, Part II 12.3 Using Databases in Web Programs.
Christopher M. Pascucci Basic Structural Concepts of.NET Managing State & Scope.
Global.asax file. Agenda What is Global.asax file How to add the Global.asax file What are the default events available Explanation to Application_Level.
Dynamic Dropdown Lists 1. Objectives You will be able to Use Dropdown Lists to solicit multiple choice user input in an ASPX web page. Populate a Dropdown.
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
Session and Cookie Management in.Net Sandeep Kiran Shiva UIN:
Introduction to ASP.Net ISYS 512. ASP.NET in the.NET Framework 1. The client requests a web page. 2. The web server locates the page. 3. If the page is.
Website Security ISYS 512. Authentication Authentication is the process that determines the identity of a user.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
CSCI 6962: Server-side Design and Programming Java Server Faces Scoping and Session Handling.
1 CS 3870/CS 5870: Note05 Prog3 Web Application with Database.
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
ASP.Net, Web Forms and Web Controls 1 Outline Session Tracking Cookies Session Tracking with HttpSessionState.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Application: Middle Tier Introducing Code-Behind Files, Session State.
CSCI 4230 Homework #3 Group Three Samer Al Jefri * Kevin Odom * David Hood * JD * Phil.
CIS 451: Cookies Dr. Ralph D. Westfall February, 2009.
Starting BBEdit or Notepad and Opening the HTML File Start BBEdit or Notepad Select Open from the File Menu Open survey1.htm from the Public Folder.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Chapter 2: Develop A One Page Web Application Liu, Jie Professor Department of Computer Science Western Oregon University
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
PLACING ORDERS- SHOPPPING CARTS. Introduction There are several stages to the order process, starting with an order page, which allows customers to add.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
ASP.NET State Management Overview Prepared By Manish Kumar Aery(IM66) Department of computer Application IET Bhaddal (Ropar)
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Chapter 7 Navigation. Objectives How to move around in your site using server controls and plain HTML How to address pages and other resources like images.
© 2016, Mike Murach & Associates, Inc.
Creating Data Base & Sql Data Source
Computing with C# and the .NET Framework
Session Variables and Post Back
Chapter 8 User Controls.
Cross-page Postbacks.
ASP.NET.
Creating Data Base & Sql Data Source
Chapter 7 Searching Your Products
5/6/2019 Session 8.2 Postback, ViewState
Presentation transcript:

Chapter 3: Develop A Multi-Page Web Application Liu, Jie Professor Department of Computer Science Western Oregon University

The Store Application  A Halloween Store – online retail One page for viewing the products  Accessing a database  Switch to a different page One page to view the shopping cart  Share information from the previous page  The Code

Some Skills  Add a class (OOP) Add an existing class  Right click on Solution Explorer  Add Existing Item Add a New class  Right click on Solution Explorer  Add Existing Item Refer a class in the class library  Add another page Right click on Solution Explorer  Add New Item, select Web Form, can provide the name of your new page  Change the name of a page Need to change the class name and “Inherits” directive manually  Set the start page Single form app, the form is displayed Or multi-form app, the selected/set one is displayed Or the default.aspx Or the directory listing -- need to set a start page  Redirect/Transfer to a different page Transfer (URL) -- ASPX only, fast because the shift happens at server, address not reflect the actual page Redirect (URL) – any page, less efficient because the shift happens at the client

Some Skills – Cross Page Posting  This is a different approach to move to a different page The new page’s URL is set in the PostBackUrl property of a button control Clicking the button results in the loading of a different page specified in the PostBackUrl property You may have access of the “Previous” Page and controls in the previous page This tool is used when no user input needs to be processed

Some Skills – Cross Page Posting Cross-page posting PageA Button PageB Previous Page  Code for the button PostBackUrl = “~/PageB.aspx”  Code to refer a control in the previous page Protected void Page_Load(object sender, EventArgs e) { if (PreviousPage != null) { TextBox txtQTY = (TextBox) PreviousPage.FindControl(“txtQTY”); lblQTY.Text = txtQTY.Text; }

Absolute and Relative URLs URLComment URL Checkout.aspxRelative URL to a file in the current directory /GoldMember/Checkout.aspxRelative URL to a file in a sub-directory../Register.aspxRelative URL at one level up../../Register.aspxRelative URL at two levels up /Register.aspxRelative URL at the root PostBackURL = “~/Intro.aspx”Relative URL at the root on controls  Absolute URLs – include domain name  Relative URLs – specify the page relative to the current page

About Data Sources  Assume you have a MS SQL Server DB  Having the data to show in a form is very easy – using the smart tag  Work on the smart tag menu to configure Select database Select retrieved data/columns

About Data Sources 

Using Data  More on later sections  Make sure the control allows postback  Make sure to bind the control with the data source  Use a Dataview to get the row and column names to get the values in the row

The Code protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) DropDownList1.DataBind(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Product selectedProduct; // show how to use an object to store a row if (DropDownList1.SelectedValue != "") { DataView dvProduct = (DataView) dtsProduct.Select(DataSourceSelectArguments.Empty); dvProduct.RowFilter = "ProductID = '" + DropDownList1.SelectedValue + "'"; DataRowView row = (DataRowView)dvProduct[0]; selectedProduct = new Product(); // initial the obj selectedProduct.UnitPrice = (decimal)row["UnitPrice"]; selectedProduct.LongDescription = row["LongDescription"].ToString(); selectedProduct.ImageFile = row["ImageFile"].ToString(); lblDescription.Text = selectedProduct.LongDescription; lblPrice.Text = selectedProduct.UnitPrice.ToString("c"); imgProduct.ImageUrl = "Images/Products/" + selectedProduct.ImageFile; }

Using Session State  The difference between an Application and a Session  SessionID – unique for each session and kept when a session state is added  It is stored as key/value pair with value being an object Session[“Cart”] = cart; // cart can be anything, a SortedList here Session.Add (“Cart”, cart); SortedList cart = (SortedList) Session[“Cart”]; SortedList cart = (SortedList) HttpContext.Current.Session[“Cart”];  Major Property: SessionID, Count, Timeout  Methods: Abandon, Clear, Remove