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.

Slides:



Advertisements
Similar presentations
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Advertisements

The Web Warrior Guide to Web Design Technologies
Microsoft VB 2005: Reloaded, Advanced Chapter 5 Input Validation, Error Handling, and Exception Handling.
Asp.NET Core Server Controls. Slide 2 Lecture Overview Understanding the types of ASP.NET controls HTML controls ASP.NET (Web) controls.
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.
Anatomy of an ASP.NET Page. Slide 2 My Version of the Big Picture (1) ASP Worker (Engine) Your application Runs Server Other applications User 1User 2.
web controls  standard controls  validation controls  rich controls.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
1 Chapter 12 Working With Access 2000 on the Internet.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Finding and Debugging Errors
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
ASP.NET Programming with C# and SQL Server First Edition
IT533 Lectures Configuring, Deploying, Tracing and Error Handling.
Web Form Fundamentals MacDonald Ch. 5 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Exceptions COMPSCI 105 S Principles of Computer Science.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 3 Using Validation Controls. What is a Validation Control? A control that validates the value in another control Renders as an HTML tag with an.
Overview of Previous Lesson(s) Over View  Server controls are small building blocks of the graphical user interface, which includes  Text boxes  Buttons.
Tracing, Logging, and Error Handling MacDonald Ch. 8 MIS 424 MIS 424 Professor Sandvig Professor Sandvig.
ASP.NET Programming with C# and SQL Server First Edition Chapter 6 Debugging and Error Handling.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
© Minder Chen, ASP.NET 2.0: Introduction - 1 ASP.NET 2.0 Minder Chen, Ph.D. Framework Base Class Library ADO.NET: Data & XML.
ASP.NET Controls. Slide 2 Lecture Overview Identify the types of controls supported by ASP.NET and the differences between them.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Tracing 1www.tech.findforinfo.com. Contents Why Tracing Why Tracing Tracing in ASP.NET Tracing in ASP.NET Page Level tracing Page Level tracing Application.
CSCI 6962: Server-side Design and Programming AJAX Tools in JSF and ASP.
Using Client-Side Scripts to Enhance Web Applications 1.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Introduction to Exception Handling and Defensive Programming.
ASP.NET OPTIMIZATION. Why Optimize? $$$ Whether you build applications for customers or not, enhanced applications save money.
Anatomy of an ASP.NET Page. Slide 2 Compiling an ASP.NET Page An ASP.NET page is compiled when it is rendered for the first time A page is compiled to.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview How to create a first ASP.NET application.
FT228/3 Web Development Error processing. Introduction READ Chapter 9 of Java Server Pages from O’reilly 2 nd Edition Need to be able to 1) Diagnose and.
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
PAGE DIRECTIVES. Page Directives  They are instructions, inserted at the top of an ASP.NET page, to control the behavior of ASP.NET pages.  So it is.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
Exceptions, handling exceptions & message boxes Year 11 Information Technology.
Christopher M. Pascucci.NET Programming: WebForm Events.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
Exceptions and Assertions Chapter 15 – CSCI 1302.
Asp.NET Core Server Controls. Slide 2 Lecture Overview Understanding the types of ASP.NET controls HTML controls ASP.NET (Web) controls.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
11 Getting Started with ASP.NET Beginning ASP.NET in C# and VB Chapters 1 and 2.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Beginning ASP.NET in C# and VB Chapter 9
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Enhanced Car Payment Calculator Application Introducing Exception Handling.
Creating an Interactive Web Page Lesson 2. Objectives.
Introduction to.
ASP.NET Forms.
Exception Handling .NET MVC
Web Development in Microsoft Visual Studio 2013
Anatomy of an ASP.NET Page
Cross-page Postbacks.
Presentation transcript:

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 tags but only one can be visible at a time Visible property is true This capability is great for implementing wizards (sequential dialog boxes) The MultiView and Wizard control can also be used

Slide 3 The Tag (2) Generally tags are the outermost tag but can be children of container controls,, etc… Non-container (server) controls must appear inside of a tag or exceptions will be thrown at run-time No compile error occurs

Slide 4 The HtmlForm Class (1) A form is accessed on the server using the HtmlForm class The DefaultButton property sets the form’s default button The button clicked when enter is pressed The InnerHtml property contains the markup between the opening and closing tags

Slide 5 The HtmlForm Class (2) The HasControls method indicates whether a from has child controls The FindControl finds the control instance with a particular ID Only direct children are searched The Focus method sets input focus to a particular control

Slide 6 Cross-Page Posting (Introduction 1) You can use a HyperLink control to create a link to another page Any Button control can be used for cross- page postbacks Set the PostBackURL property to the desired Web page

Slide 7 Cross-Page Posting (Introduction 2) Use the Server.Transfer method The target page is passed as an argument Any code following Server.Transfer is not executed Server.Transfer(“DestinationPage.aspx”);

Slide 8 Cross-Page Posting (Getting Data from the Previous Page) The PreviousPage property of the Page object contains a reference to the page that caused the postback This property allows you to get at the controls from the previous form and their values This is magically accomplished through viewstate

Slide 9 Cross-Page Posting (Example) Get a reference to a control on another page and print the text TextBox txt; txt = (TextBox)PreviousPage.FindControl( "txtPreserve"); Response.Write(txt.Text);

Slide 10 Detecting Cross-Page Postbasks (1) Test the PreviousPage property to see if it is null If it is, the page was not loaded as a cross-page postback Test the IsCrossPagePostBack property of the ‘posting’ page

Slide 11 Detecting Cross-Page Postbacks (2) directive allows you to use strongly typed syntax if page “b” will only be posted from page “a”

Slide 12 Cross page Postback vs. Server.Transfer Cross page postbacks are client-based The Transfer method is server-based Both allow you to reference the PreviousPage property

Slide 13 Introduction to Error Handling Just like desktop applications, exceptions are thrown in various cases Divide by 0, IO, Database, etc. Unhandled, we call these the yellow page of death What happens depends on the following Web.config setting:

Slide 14 Error Message ( Debug=true )

Slide 15 Error Message ( Debug=false )

Slide 16 Error Message – Enabling Debugging

Slide 17 Error Message – Enabling Script Debugging

Slide 18 Handling Errors (Introduction) Exception handlers are created (as usual) using try, catch blocks The Page_Error event handler gives you a global exception handler for the page The Application_Error event applies to the entire application itself

Slide 19 Handling Errors (Introduction) Use Server.GetLasError() to get information about the most recent error Use Server.ClearError() to clear the exception Create other exception handlers, as necessary

Slide 20 Configuring Custom Errors It’s all controlled by the customErrors section of the Web.config file Attributes defaultRedirect attribute causes a redirect to the specified page Mode attribute enables / disables custom errors On – Enables custom for remote and local hosts Off – Disables custom errors RemoteOnly – (default) Custom errors are displayed to the remote client

Slide 21 Configuring Custom Errors (Example)

Slide 22 Tracing (Introduction) It’s possible to trace execution by enabling tracing in the Web.config directives can also be used Example See handout

Slide 23 Tracing (Output)