Christopher M. Pascucci.NET Programming: WebForm Events.

Slides:



Advertisements
Similar presentations
Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
Advertisements

11 ASP.NET Slides based off:. 22 B ACKGROUND - W EB A RCHITECTURE Web Server PC/Mac/Unix/... + Browser Client Server Request:
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
NAMEd anchors Enabling users to jump to specific points within Web documents.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
.Net Overview Data Driven Desktop and Web Applications using VB.Net and ASP.Net, C#.Net or J#.Net.
Server-Side Scripting with ASP.Net ISYS 546. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection.
NAMEd anchors Enabling users to jump to specific points within Web documents.
Introduction to ASP.Net ISYS 350. ASP.NET ASP.NET is a server-side technology for creating dynamic web pages. ASP.NET allows you to use a selection of.
IT 533 Lecture Notes Gül ş en Demiröz Introduction to Web Programming using ASP.NET.
11 ASP.NET Controls Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
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.
Web Form Fundamentals MacDonald Ch. 5 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
JavaScript & jQuery the missing manual Chapter 11
DR.JOHN ABRAHAM PROFESSOR UTPA ASP.NET. ACTIVE SERVER PAGES (ASP) Web application development environment Web applications use web browser to display.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Christopher M. Pascucci.NET Programming: Forms & Controls.
Christopher M. Pascucci.NET Programming: Basic ASPX Scripting & HTML Embedment.
Chapter 19: Adding JavaScript
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
INSPIRING CREATIVE AND INNOVATIVE MINDS Module 4: Adding Code to a Microsoft ASP.NET Web Form Implementing Code-Behind Pages Adding Event Procedures to.
© Minder Chen, ASP.NET 2.0: Introduction - 1 ASP.NET 2.0 Minder Chen, Ph.D. Framework Base Class Library ADO.NET: Data & XML.
IT 533 Lecture Notes Introduction to Web Programming using ASP.NET.
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.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Introduction to ASP.NET1. 2 Web applications in general Web applications are divided into two parts –The server part –The client part The server part.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Unit 3: Adding Code to a Microsoft ASP.NET Web Form.
Christopher M. Pascucci Basic Structural Concepts of.NET Managing State & Scope.
Overview of Previous Lesson(s) Over View  SDI programs  The Application Wizard can generate single-document interface (SDI) applications that work.
Module 1: Working with ASP.NET. Overview Introducing ASP.NET Creating Web Forms Adding ASP.NET Code to a Page Handling Page Events Discussion: ASP vs.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
44238: Dynamic Web-site Development Client Side Programming Ian Perry Room:C48 Extension:7287
Event JavaScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is.
Christopher M. Pascucci.NET Programming CodeBehind.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
Module 4: Creating a Web Application with Web Forms
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
COS 125 DAY 20. Agenda Assignment 8 not corrected yet Assignment 9 posted  Due April 16 New course time line Discussion on Scripts 
MIS 3200 – Unit 3.2 Page_Load method AutoPostBack property of controls IsPostBack method of the Page object Understanding web page life cycle.
USING JAVASCRIPT TO SHOW AN ALERT Web Design Sec 6-2 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
11 ASP.NET Server Controls Beginning ASP.NET in C# and VB Chapter 4.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
1111 Creating ASPX Controls Programatically Objectives You will be able to Dynamically add controls to a page. Dynamically alter properties of 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.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
PostBack  When an initial request for a page (a Web Form) is received by ASP.NET, it locates and loads the requested Web Form (and if necessary compiles.
 ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These.
Beginning ASP.NET in C# and VB Chapter 9
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
Creating an Interactive Web Page Lesson 2. Objectives.
Computing with C# and the .NET Framework
ASP.NET Forms.
Using JavaScript to Show an Alert
Unit 27 - Web Server Scripting
Module 10: Creating a Web Application with Web Forms
Web Development Using ASP .NET
Presentation transcript:

Christopher M. Pascucci.NET Programming: WebForm Events

Web Forms Events  Events occur as a response to a user’s actions that triggers a response from the server.  Click of a button  Selection of an item from a dropdown list  Pressing a key  Moving the mouse  There are Page level events that are already defined and can be used by the programmer.  Page_Load  Page_UnLoad  Page_Init

Web Forms Events  Functions that respond to an event can be located in the following places:  If the function is to be processed on the client-side, then it must be in coded and located in between a script tag on the aspx page, without the runat=“server”.  If the function is to be processed on the server-side within the aspx page, then it must be in coded in between a script tag on the aspx page, with the runat=“server”.  If the function is to be processed on the server-side in a CodeBehind, then is must be coded in the CodeBehind file with the following syntax : Public Sub SomeName(ByVal sender As Object, ByVal e As EventArgs)

Web Forms Events  Note: A more convenient way to create a runat server event Sub in the CodeBehind is simply to double click on the control on the ASPX page in Design Mode.  This will automatically create the proper, but slightly different, Sub syntax in the Code Behind (and place you in the Code Behind page as well). Private Sub btnMySubmit_Click(ByVal source As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click

Web Forms Events  Examples: 1.) The OnClick event transfers control to the function cmdProcess() that is processed on the client side. 2.) The OnClick event transfers control to the function cmdProcess() that is processed on the server side. 3.)Processed on server side by a public function named cmdProcess() without handler 4.) Processed on server side by the private function implemented by double-clicking on the dropdown list in the Design mode.

Web Forms Events  Examples: 5.) Processed on server side by a public function named listProcess without handler 6.) Processed on server side by the private function implemented by double-clicking on the dropdown list in the Design mode. Written in the CodeBehind automatically Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged.

Web Forms Events  There are many other events for WFC and HFC controls other than the onclick. When using the VS.NET IDE you can find all events that a particular control can respond to by simply typing a space after the control tag. These events have a yellow lightning icon when using intellisense. HFC:  onkeyup, onkeydown, onkeypress  onchange (textbox or dropdownlist) WFC:  OnTextChanged, OnSelectedIndexChange  You must set the attribute AutoPostback=“True” or it will do nothing. When using these events, AutoPostback=True causes a Postback to occur that will transfer control back to the server.

Program Flow Control  When the ASPX page is loaded, there is a ten step lifecycle that is fairly complex. A description of this lifecycle is presented in the textbook on page 193. Another description and web article Reference are also provided at this link.Another description and web article Reference are also provided at this link  However, for the purpose of this course, a highly simplified version of these ten steps is presented here as a 3 step lifecycle: 1.If there is a PageLoad() function in the CodeBehind, it will execute before any other processing on the page. You can use IsPostback to determine whether it is the initial load of the page or any subsequent load. 2.If there is an event raised from the aspx form (as discussed in previous slides) on the client side, and there is a Code Behind function that responds to this event, then it will execute. It is important to note that if you use both the PageLoad() function and an event responding function in the CodeBehind, then both will run, but PageLoad() runs first. 3.All server side code in the aspx page will be execute. This includes and  When the CodeBehind and the aspx script have been completely processed (and its html downloaded to the browser), the CodeBehind object is destroyed. If there is a postback, the aspx page and its CodeBehind are reloaded, and the CodeBehind object is instantiated again. This means that all objects declared within the CodeBehind are also re-instantiated.