MIS 3200 – Unit 6.1 Moving between pages by redirecting

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

MIS 3200 – Unit 4 Complex Conditional Statements – else if – switch.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
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.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
MIS 3200 – Unit 6.2 Learning Objectives How to move data between pages – Using Query Strings How to control errors on web pages – Using Try-catch.
Unit 8.2 Learning Objectives How data can be used – The Money Ball Example The Money Ball Example Data Warehouses – The Role of Data Warehouses The Role.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
IT533 Lectures Session Management in ASP.NET. Session Tracking 2 Personalization Personalization makes it possible for e-businesses to communicate effectively.
Web Design (5) Navigation (1). Creating a new website called ‘Navigation’ In Windows Explorer, open the folder “CU3A Web Design Group”; and then the sub-folder.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
MIS 3200 – C# (C Sharp)
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
MIS 3200 – Unit 4.2 ListItem controls – CheckBoxList – ListBox.
CIS 338: Using Queries in Access as a RecordSource Dr. Ralph D. Westfall May, 2011.
Caching Chapter 12. Caching For high-performance apps Caching: storing frequently-used items in memory –Accessed more quickly Cached Web Form bypasses:
1 CS 3870/CS 5870 Note04 Session Variables and Post Back.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
How to Build a Struts Application with JBuilder 9.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
MIS 3200 – Unit 5.3 Manipulating ListItem controls – Moving ListItems between ListItem controls – Removing ListItems from ListItem controls.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Introduction to JavaScript CS101 Introduction to Computing.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
CIS 451: Cookies Dr. Ralph D. Westfall February, 2009.
® IBM Software Group © 2006 IBM Corporation JSF Rich Text Area Component This Learning Module describes the use of the JSF Rich Text Area component – for.
MIS 3200 – Unit 3.2 Page_Load method AutoPostBack property of controls IsPostBack method of the Page object Understanding web page life cycle.
MIS 3200 – Unit 5.1 Iteration (looping) – while loops – for loops Working with List Items.
Basic ActionScript and PHP Cis 126. Getting Started set up a basic folder structure so we can keep our files organized. Mirror this structure on your.
1 Project 2: Using Variables and Expressions. 222 Project 2 Overview For this project you will work with three programs Circle Paint Ideal_Weight What.
PHP Form Processing * referenced from
Unit 8.2 Learning Objectives Data Warehouses – The Role of Data Warehouses The Role of Data Warehouses – Group Exercise Accessing Data in Views – Accessing.
1 4.2 Selection Logical Operators. 2 Learning Objectives Explain how the logical operator AND Boolean statements works. Directly testing if text boxes.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
MIS 3200 – C# (C Sharp)
Computing with C# and the .NET Framework
Unit 7 Learning Objectives
Unit 9.1 Learning Objectives Data Access in Code
JavaScript and Ajax (Ajax Tutorial)
Coldpruf Online Order Form
Creating Oracle Business Intelligence Interactive Dashboards
Working in the Forms Developer Environment
Session Variables and Post Back
© 2015, Mike Murach & Associates, Inc.
USING DREAMWEAVER Contents: Assigning a Root Folder
Unit 8.2 How data can be used Accessing Data in Views
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Using Access and the Web
Intro to PHP & Variables
Unit 27 - Web Server Scripting
Multi-host Internet Access Portal (MIAP) Enhancement Guide
Part 2 Setting up a web server the easy way
MIS 3200 – Unit 4 Complex Conditional Statements else if switch.
(Includes setup) FAQ ON DOCUMENTS (Includes setup)
MODULE 7 Microsoft Access 2010
Unit 9.3 Learning Objectives Review database access in code
Forms, cont’d.
MIS 3200 – Unit 5.2 ListItem controls and accumulation
Part 2 Setting up a web server the easy way
Fonts, TabControl, ListBox
Web Development Using ASP .NET
Training & Development
MIS 3200 – Unit 5.1 Iteration (looping) Working with List Items
(Includes setup) FAQ ON DOCUMENTS (Includes setup)
MIS 3200 – Unit 2.2 Outline What’s the problem with bad data?
Coldpruf Online Order Form
Executive Reports, Instructions and Documentation
Presentation transcript:

MIS 3200 – Unit 6.1 Moving between pages by redirecting Moving data between pages with session variables

Page redirection If we want to send a user to a different page, we can do this using Response.Redirect. For example: Before a user is re-directed to a new page, we have to consider what happens to any data entered on the page and how to move that data to the new page. One way we can address this problem is by using session state and storing session variables in the session state.

Session State – What is it? “ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session.” – http://msdn.microsoft.com/en-us/library/ms178581.aspx

Declaring session variables Examples of declaring session variables: notice the usage of brackets [] instead of squiggles {} or parentheses () when working with session variables

Using session variables Before Session Variables can be used, they must be converted to the data types they were before.

Casting session variables Considered as describing an object as a web control The Session[“lbSelectedItems”] had to be created on a previous page (similar to slide 5) before this casting example would work. Casting takes an object (in this example, a session variable) and allows us to describe the object as a specific type of object (e.g. a ListBox). Once the object has been cast, it can be assigned to a variable of the casted data type. For example: This allows the contents of the session variable to now reside in a ListBox where we can treat it like any other ListBox control we have worked with. Note, the Session[“lbSelectedItems”] had to be created on a previous page (similar to slide 5) before this casting example would work.

Casting session variables Since session variable are stored as objects, they must be converted or cast before they can be used. Here is a casting example:

Unit 6 L1 Moving data between pages Create two pages, one called lastnameU6L1_1.aspx and another called lastnameU6L1_2.aspx Add heading Unit 6 L1 - Session Variables (page 1) and Unit 6 L1 - Read Session Variables (page 2) On the U6L1_1.aspx page, add a TextBox and a Button In the button click method, assign the content of the textbox to a session variable called contentsOfTextBox Redirect the user to the 2nd page

L1 #2 On the U6L1_2.aspx page, in the Page_Load method: Test to see if the session variable is null or the text is blank If it is null or blank, redirect the user back to the U61_1.aspx page Otherwise, build a string and assign the string to the label (you need to add a label to this page) Add a button on the U6L1_2.aspx page that resets the session variable (set it to null) and redirects the user back to the 1st page:

L1 #3 Add a heading to reflect this is Unit 6 L1 Add appropriate comments to explain what the methods are doing Create a link to your U6L1 page from your MIS3200 page and copy everything to ASPNET and submit your MIS Portfolio URL to the drop box.

Time to try it out – Unit 6 L2 Creating and reading session variables Copy your Unit5L2.2.aspx file to your Unit 6 folder and rename it to lastnameU6L2_1.aspx and create a 2nd page called lastnameU6L2_2.aspx Update the heading to be Unit 6 L2 – Creating Session Variables (in the 1st file) and Unit 6 L2 – Reading Session Variables (in the 2nd file) In U6L2_2.aspx, add an empty ListBox (which will hold the selected fees that will be stored in a session variable) Set the SelectionMode to Multiple Set the Rows to 5

L2 #2 In the button click method of the Calculate sales tax and total create two session variables, one will store the contents of the selected ListBox one will store the contents of the invoice label your existing “clean-up” code can be commented out redirect the user to U6L2_2.aspx In U6L2_2.aspx, add a label above the ListBox and set the Text property to You selected the following fees: add a label below the ListBox to hold the invoice add a button with the Text set to Make a new selection and in the button click method, reset both session variables and redirect the user back to the 1st page

L2 #3 Test the Make a new selection functionality by trying to run the 2nd page directly from within Web Developer – this should redirect the user to the U6L2_1.aspx page (since the session variables are set to null – you will need to test the session variables in the page_load to make sure they exist and if not, send them to the U6L2_1.aspx page) Add appropriate comments to explain what the the methods are doing Create a link to your U6L2_1.aspx page from your MIS3200 page and copy everything to ASPNET and submit your MIS Portfolio URL to the drop box.

Think About It! Why do we need to move data between pages? What does casting do? How do you cast a session variable as a label?