1 / 24

Module 1: Working with ASP.NET

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. ASP.NET. Introducing ASP.NET. The .NET Framework ASP.NET Features Animation: The ASP.NET Execution Model. ADO.NET: Data & XML.

anthea
Télécharger la présentation

Module 1: Working with ASP.NET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. ADO.NET: Data & XML Base Class Library Web Services UserInterface Common Language Runtime Visual Studio.NET Orchestration .NET Framework .NET EnterpriseServers Building Block Services Internet COM+ Windows The .NET Framework

  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 <%@ Page Language=“C#" %> <Form runat="server"> </Form>

  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 theSystem.Web.UI.WebControls namespace <input type="text" id="txtName" runat="server"> <span id="spnStarter" runat="server"> starter</span> <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 <input type="text" id="text2" runat="server">

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

  14. Adding ASP.NET Code to a Page • Creating ASP.NET <SCRIPT> Section • Creating Event Procedures • Demonstration: Adding Code to Controls

  15. Creating ASP.NET <SCRIPT> Section • Declaring the Language • Declaring Functions and Subroutines <script language="VB" runat="server"> <script language="C#" runat="server"> <SCRIPT LANGUAGE="VB" runat="server"> Sub login () 'contents of routine End Sub </SCRIPT>

  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"> Sub GreetMe(s As Object, e As EventArgs) 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_Init Page is disposed Page_Load Textbox1_Changed Button1_Click Page_Unload

  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

  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

More Related