February 16, 2013
Aaron Cuffman Andy Nagle Adam Schultz Web Site
Objectives Learn the fundamentals of Server-client relations and Page events Sate management Controls and Layouts Databinding JavaScript and ASP.NET
Procedures Seminar will consist of 5 Lessons & 5 Labs Labs are designed for individuals Group work will be accommodated Each Lab is self contained If you are unable to complete a lab or partial seminar attendance occurs; labs can be completed on your own Next lab will not require prior lab completion Open Conversation Object is to help you learn the material
Agenda 9:00 – 9:30 Lesson 1: Introduction to ASP.NET 9:30 – 10:00 Lab 2 10:00 – 10:30 Lesson 2: State Management 10:30 – 10:45 Break 10:45 – 11:15 Lesson 3: Standard SQL 11:15 – 11:45 Lab 2 11:45 – 12:30 Break 12:30 – 1:00 Lesson 3: Controls 1:00 – 1:30 Lab 3 1:30 – 2:00 Lesson 4: Data Binding 2:00 – 2:30 Lab 4 2:30 – 3:00 Lesson 5: JavaScript 3:00 – 3:30 Lab 5 3:30 – 4:00 Wrap Up
An adventure in TIME and SPACE!
What is ASP.NET? Web Application framework Used in building dynamic web pages Built on CLR You can write ASP.NET code in any.NET language C#, VB, etc.
What is ASP.NET? Gives the “feel” of building a WinForm/WPF style page, but with web pages Can be misleading if you haven’t seen the page life cycle [EPIC FORECHADOWING] which we will cover soon.
Design vs Code Behind ASPX (Design) and.CS/.VB (Code Behind) Separates display from business logic Makes it easy to have multiple people working on the same page Designer working on the designer page Programmer working on the Code Behind Not restricted to using Visual Studio Ex: Blend
Design vs Code Behind ASPX page The “designer” view. This describes the layout of the page Code Behind Page Responds to events from the designer view Page logic goes here Redraw the page, make new queries, show/hide page sections
Request Path Two major roles. Client and Server Client Makes requests to the server Server Turns requests into HTML pages (or files, or media)
Page Life Cycle Once a server receives a request for a page, it needs to render that page Takes the ASPX file plus the code for the events and turns them into HTML
Pre Init Raised after the start stage is complete and before the initialization stage begins. Used to: Create dynamic controls Set master page Set themes Initialize page content before Init
Init Raised after all controls have been initialized and any skin settings have been applied The Init event of individual controls occurs before the Init event of the page. Used to: Initialize controls before Load Last chance to do anything before the ViewState is loaded
Load The Page object calls the OnLoad method on the Page object, and then recursively does the same for each child control until the page and all controls are loaded. Used to: Set Properties for controls Establish Database Connections “ready” your page
Control Events Button Click, Checkbox Changed, Textbox Changed, etc. These events are processed in the order they occur
Pre Render Raised after the Page object has created all controls that are required in order to render the page Last chance to change anything before rendering the page
Render This is not an event; instead, at this stage of processing, the Page object calls this method on each control. Turns Controls into markup to send to the browser If you create a custom control, you typically override this method to output the control's markup.
Unload Raised for each control and then for the page. Used as final cleanup for controls At the end of this process, the page is destroyed. During the unload stage, the page and its controls have been rendered, so you cannot make further changes to the response stream.
Page Life Cycle Much more information on MSDN