Christopher M. Pascucci.NET Programming CodeBehind.

Slides:



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

Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
11 ASP.NET Slides based off:. 22 B ACKGROUND - W EB A RCHITECTURE Web Server PC/Mac/Unix/... + Browser Client Server Request:
Web server (serves web pages).NET Framework (executes code) ASP.NET processor Internet Information Services Server HTTP requestASP.NET code OutputHTML.
ASP Tutorial. What is ASP? ASP (Active Server Pages) is a Microsoft technology that enables you to make dynamic and interactive web pages. –ASP usually.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
Web Platform Introduction With a focus on “free” Mike Taulty Developer & Platform Group Microsoft Ltd
Tutorial -01. Objective In this session we will discuss about : 1.What is MVC? 2.Why MVC? 3.Advantages of MVC over ASP.NET 4.ASP.NET development models.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Course Textbook: Build Your Own ASP.Net Website: Chapter 2
Web Forms. Agenda Web forms Web controls Code separation Dynamic compilation System.Web.UI.Page User controls.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College Lecture 8: WebForms — Web-based.
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
Chapter 9 Web Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
DR.JOHN ABRAHAM PROFESSOR UTPA ASP.NET. ACTIVE SERVER PAGES (ASP) Web application development environment Web applications use web browser to display.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
February 16, Aaron Cuffman Andy Nagle Adam Schultz Web Site.
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: Basic ASPX Scripting & HTML Embedment.
ASP.NET and Model View Control Jesper Tørresø ITNET2 F08.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
© Minder Chen, ASP.NET 2.0: Introduction - 1 ASP.NET 2.0 Minder Chen, Ph.D. Framework Base Class Library ADO.NET: Data & XML.
Introduction to ASP.NET 1www.tech.findforinfo.com.
ASP.NET application. Roadmap ASP.NET file types Bin directory Application updates Simple application from start to finish using a virtual directory Behind.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Cross-Language Demo Demonstrates mixing C# and VB.NET code C# Class CSDemoClass.cs VB.NET Class VBDemoClass.vb “Main” class (C#) Demo.cs.
CIS 451: ASP.NET Concepts Dr. Ralph D. Westfall January, 2009.
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.
COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Unit 3: Adding Code to a Microsoft ASP.NET Web Form.
Web User Controls This presentation will cover the basics of defining, creating and using a web user control. Presented to Twin Cities.NET user group By.
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.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Module 4: Creating a Microsoft ASP.NET Web Form. Overview Creating Web Forms Using Server Controls.
Session 4: HTML and Web Server Controls. Outline Creating Web Forms Using Server Controls HTML Server Controls Web Server Controls Writing ASP Code Inline.
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.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview How to create a first ASP.NET application.
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.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
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.
Christopher M. Pascucci.NET Programming: WebForm Events.
Introduction to ASP.NET What is ASP.NET and how is different from ASP –ASP: server side technology for creating dynamic web pages using scripting languages.
ASP.NET User Controls. User Controls In addition to using Web server controls in your ASP.NET Web pages, you can create your own custom, reusable controls.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
1 10/19/05CS360 Windows Programming ASP.NET. 2 10/19/05CS360 Windows Programming ASP.NET  ASP.NET works on top of the HTTP protocol  Takes advantage.
PROGRAMMING IN VISUAL BASIC.NET CREATING YOUR FIRST WEB APPLICATION Bilal Munir Mughal 1 Chapter-3.
CIS 375—Web App Dev II ASP.NET 1 Getting Started.
Chapter 2: Develop A One Page Web Application Liu, Jie Professor Department of Computer Science Western Oregon University
1111 Creating HTML Programatically Objectives You will be able to Invoke C# code on the server from an ASP.NET page. Write C# code to create HTML.
E-commerce Foundations By Dr. Gabriel. Using 3-Tier/N-Tier Architecture The presentation tier The business tier The data tier.
JSP / Servlets and Beans
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
ASP.NET Architecture Mike Taulty Developer & Platform Group Microsoft Ltd
1 Introducing Web Developer Tools Rapid application development tools ASP.NET-compatible web editors –Visual Studio.NET Professional Edition –Visual Studio.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Chapter 2 Creating Website with Web Forms. Objectives Understand the different project types and templates when building ASP.NET web sites. The different.
ASP.NET Forms.
Introduction to ASP By “FlyingBono” 2009_01 By FlyingBono 2009_01
ASP.NET 2.0 Overview Created By: Ajay Bahoriya.
Presentation transcript:

Christopher M. Pascucci.NET Programming CodeBehind

What is a CodeBehind?  The ASPX file contains HTML and the ASP tags for the server controls (WFC).  A CodeBehind refers to a separate class file that contains code for your ASP.NET page.  The code is one large class (or partial classes) that is compiled and runs your ASP.NET page.  This code is processed on the server.  The CodeBehind file replaces the need to use inline ASP scripting and script tags  Inline scripting  Tags  Major advantage is that is allows for a clean separation of the HTML markup (design of the page) and the logic of the page.

CodeBehind  When you add an ASPX WebForm page to your project in Visual Studio it also adds to files attached to the aspx file.  The Designer file contains code automatically generated by the designer when you use the Design mode in Visual Studio It has the same name as the aspx file, but adds the file extension designer.vb Example: Order.aspx.designer.vb (for VB) OR Order.aspx.designer.cs (for C#) This code is stored in a separate file to create a less cluttered programming environment in a partial class.  The CodeBehind file contains server-side code & events that run your page. It has the same name as the aspx file, but has the file extension.vb Example: Order.aspx.vb  These two files are compiled into an assembly (.dll file).

How an ASP.NET Application is Compiled  When an ASPX page is requested for the first time. 1.The CodeBehind class file and any other partial class files are compiled into an assembly (.dll). 2.The ASP.NET runtime will call the VB compiler to compile any other classes that were created. A product class that you may have created to store information about a single product. A cart class that you may have created to store products. These classes are called components that don’t have any affect on the processing of the page and are created by the programmer as a utility. 3.ASP.NET creates an instance of the page and raises the appropriate events like Page_Load. This only occurs after all files have been compiled into assemblies. 4.Finally, generates the HTML that is passed back to the Web Server for the response.  These steps only occur the first time an aspx page is requested. After that, the page is processed directly from the compiled assemblies (.dll files).  These saved assemblies are reused so the application doesn’t need to be recompiled.

Summary  The CodeBehind class is automatically instantiated.  The class file (blueprint) becomes an object that can be used.  When the ASPX page has been completely processed and its HTML has been downloaded to the browser, the CodeBehind object is destroyed.  All objects within the class will be re-intialized.  Anything declared or used in the CodeBehind is gone unless you programmatically maintain state.  When another request is made (postback) the CodeBehind class is instantiate again and all the objects are initialized. This occurs over and over again for each postback.