Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Module 1: Working with ASP.NET

2 Overview Introducing ASP.NET Creating Web Forms Adding ASP.NET Code to a Page Handling Page Events Discussion: ASP vs. ASP.NET

3  Introducing ASP.NET The.NET Framework ASP.NET Features Animation: The ASP.NET Execution Model

4 The.NET Framework.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET Base Class Library ADO.NET: Data & XML User Interface Common Language Runtime WebServices

5 ASP.NET Features Multiple Language Support Increased Performance Compiled code Cache Classes and Namespaces Server Controls Web Services

6 ASP.NET Features (continued) Improved Security Greater Scalability Cookie-less Sessions Easy Configuration and Deployment

7 Animation: The ASP.NET Execution Model

8  Creating Web Forms What Are Web Forms? What Are Server Controls? Types of Server Controls How Do Server Controls Work? Demonstration: Adding Server Controls to an ASP.NET Page

9 What Are Web Forms?.aspx extension @Page Directive Framework Is an Object Model Denoted by the runat="server" Attribute Contain Client-side and Server-side Code Contain HTML and Server Controls

10 What Are Server Controls? Server-programmable Objects Denoted by Tag with the runat = "server" Attribute Encapsulate Both Behavior and Rendering Fully Declarative Render Different HTML to Support Multiple Browsers or other Web Clients

11 Types of Server Controls HTML Controls Exist within the System.Web.UI.HtmlControls namespace Web Controls Exist within the System.Web.UI.WebControls namespace starter starter <asp:TextBox id="txtName" runat="server" Text="[Entry Keywords]"/> <asp:TextBox id="txtName" runat="server" Text="[Entry Keywords]"/>

12 How Do Server Controls Work? Declared with runat="server" Attribute When the ASP.NET Page is Executed: Creates action and method attributes of form Adds unique id and name attributes to controls Adds value attribute to controls Adds a hidden control to the form to save view state information

13 Demonstration: Adding Server Controls to an ASP.NET Page

14  Adding ASP.NET Code to a Page Creating ASP.NET Section Creating Event Procedures Demonstration: Adding Code to Controls

15 Creating ASP.NET Section Declaring the Language Declaring Functions and Subroutines Sub login () 'contents of routine End Sub Sub login () 'contents of routine End Sub

16 Creating Event Procedures Assign a Method Name to the Event Attribute Create an Event Procedure in Your Page Code Access Properties of Controls in the Event Procedure <input type="submit" value="Submit!" onServerClick="GreetMe" runat="server"> <input type="submit" value="Submit!" onServerClick="GreetMe" runat="server"> Sub GreetMe(s As Object, e As EventArgs) spnGreeting.InnerHTML = "Hello " & _ txtName.Value End Sub Sub GreetMe(s As Object, e As EventArgs) spnGreeting.InnerHTML = "Hello " & _ txtName.Value End Sub

17 Demonstration: Adding Code to Controls

18  Handling Page Events Page Event Life Cycle Handling Postback Forms Demonstration: Using Postback Forms

19 Page Event Life Cycle Page_Load Page_Unload Textbox1_Changed Button1_Click Page is disposed Page_Init

20 Handling Postback Forms ViewState Control Maintains the State of a Page During Postback Page_Load Fires on Every Request Use Page.IsPostBack to execute conditional logic Sub Page_Load(s As Object, e As EventArgs) If Not Page.IsPostBack Then 'executes only on initial page load End If 'Rest of procedure executes on every request End Sub Sub Page_Load(s As Object, e As EventArgs) If Not Page.IsPostBack Then 'executes only on initial page load End If 'Rest of procedure executes on every request End Sub

21 Demonstration: Using Postback Forms

22 Discussion: ASP vs. ASP.NET

23 Lab 1: Using ASP.NET to Output Text

24 Review Introducing ASP.NET Creating Web Forms Adding ASP.NET Code to a Page Handling Page Events Discussion: ASP vs. ASP.NET


Download ppt "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."

Similar presentations


Ads by Google