Download
slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
INSPIRING CREATIVE AND INNOVATIVE MINDS PowerPoint Presentation
Download Presentation
INSPIRING CREATIVE AND INNOVATIVE MINDS

INSPIRING CREATIVE AND INNOVATIVE MINDS

107 Views Download Presentation
Download Presentation

INSPIRING CREATIVE AND INNOVATIVE MINDS

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Module 3: Creating a Microsoft ASP.NET Web Form • Creating Web Forms • Adding Server Controls to a Web Form • Creating Master Pages INSPIRING CREATIVE AND INNOVATIVE MINDS

  2. Lesson: Creating Web Forms • What Is a Web Form? • Creating a Web Form by Using Visual Studio 2008

  3. What Is a Web Form? • Web Forms have the following features: • .aspx extension • Page attributes • @ Page directive • Body attributes • Form attributes <%@ Page Language=“C#" CodeFile=“NewForm.aspx.cs" Inherits=“NewForm" %> <html> <body> <form id=“form1" runat="server"> </form> </body> </html>

  4. Creating a Web Form by Using Visual Studio 2008 • Create a new Web application • Default Web Form for a new application: Default.aspx • Add additional Web Forms to an existing application • In Solution Explorer user the Add New Item dialog box

  5. Lesson: Adding Server Controls to a Web Form • What Is a Server Control? • Types of Server Controls • Saving View State • HTML Server Controls • Web Server Controls • Discussion: Selecting the Appropriate Control

  6. Server controls: Contain runat="server" attribute Events happen on the server View state saved Provide built-in functionality Provide a common object model All have ID and Text attributes Create browser-specific HTML What Is a Server Control? <asp:Button ID="Button1" runat="server" Text="Submit"/>

  7. Types of Server Controls • HTML server controls • Web server controls • Intrinsic controls • Validation controls • Rich controls • List-bound controls • Login controls

  8. Saving View State • View state • Control state • Use view state to maintain the control's contents • Use control state to maintain the core behavior of the control • HiddenField control <asp:ListBox ID="ListName" EnableViewState="true" runat="server"> </asp:ListBox>

  9. HTML Server Controls • Based on HTML elements • Exist in the System.Web.UI.HtmlControls namespace <input type="text" id="txtName" runat="server" />

  10. Web Server Controls • Exist in the System.Web.UI.WebControls namespace • Control syntax • HTML that is generated by the control <asp:TextBox id="TextBox1" runat="server">Text_to_Display </asp:TextBox> <input name="TextBox1" type="text" value="Text_to_Display" Id="TextBox1"/>

  11. Discussion: Selecting the Appropriate Control • Is it ever appropriate to use HTML server controls instead of Web server controls?

  12. Lesson: Creating Master Pages • What Are Master Pages? • Content Pages • Runtime Behavior of Master Pages • Discussion: Advantages of Master Pages

  13. What Are Master Pages? • Master pages provide a simple method to create a consistent layout across a Web site • Master pages have the following features: • File extension of .master instead of .aspx • @ Master directive instead of the @ Page directive • ContentPlaceHolder controls, which define the areas where the replaceable content appears • Top-level HTML elements for a page, such as html, head, and form • Master pages can be nested

  14. Content Pages • Content pages are Web pages that reference a master page • MasterPageFile attribute in @ Page directive • Content pages have their own page-specific content <%@ Page Language="C#" MasterPageFile="~/benefitsMaster.master" AutoEventWireup="true" CodeFile="contentPage.aspx.cs" Inherits="contentPage" %>

  15. Runtime Behavior of Master Pages Master Page Content Page Resulting Web Page

  16. Discussion: Advantages of Master Pages • What are the advantages of master pages in a Web application?

  17. Lab: Creating a Microsoft ASP.NET Web Form • Exercise 1: Creating the Default.aspx Web Form • Exercise 2: Creating the benefitsMaster Master Page • Exercise 3: Creating the life.aspx Web Form Estimated time: 30 minutes

  18. Lab Scenario Master PagebenefitsMaster.master Logon Page login.aspx BenefitsHome PageDefault.aspx Lab Web Application ASPState Page Headerheader.ascx Menu ComponentBenefits.cs or Benefits.vb Registration register.aspx TempDB Web.config Life Insurancelife.aspx Retirementretirement.aspx Medicalmedical.aspx Dentistsdental.aspx Prospectusprospectus.aspx XML Web ServiceDentalService1.asmx Doctorsdoctors.aspx User ControlnameDate.ascx LINQ to SQLClassesDoctors.dbml Dentists Doctors XML Files