INTRODUCTION TO ASP.NET - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

INTRODUCTION TO ASP.NET

Description:

Chapter 6 INTRODUCTION TO ASP.NET Objectives In this chapter, you will: Learn about the .NET framework, ASP.NET, and .NET server controls Become familiar with the ... – PowerPoint PPT presentation

Number of Views:339
Avg rating:3.0/5.0
Slides: 42
Provided by: NATE157
Category:

less

Transcript and Presenter's Notes

Title: INTRODUCTION TO ASP.NET


1
Chapter 6
  • INTRODUCTION TO ASP.NET

2
Objectives
  • In this chapter, you will
  • Learn about the .NET framework, ASP.NET, and .NET
    server controls
  • Become familiar with the .NET class libraries
  • Learn how to create Web application projects
  • Learn how to use the Visual Studio .NET
    integrated development environment to create and
    manage Web application projects

3
Objectives
  • In this chapter, you will
  • Learn how to create and modify Web application
    project components
  • Learn how to access and reference Web forms
  • Learn how to move a Web application project's
    files to a different physical folder

4
The .NET Framework
  • Web application one or more files that
    developers create to solve a problem or provide a
    service through a Web site
  • .NET framework a set of code, objects, and
    standards for building computer applications

5
The .NET Framework
  • Programs can be created within the .NET framework
    using Visual Basic, Visual C, C, and JScript
    languages
  • When a .NET program is created using any of these
    languages, the code is compiled into a common
    intermediate language called the Microsoft
    Intermediate Language (MSIL)
  • The Common Language Runtime (CLR) application
    runs the MSIL program

6
The .NET Framework
  • .NET framework
  • All elements are objects
  • Defines objects using a standard set of programs
    that are called class libraries
  • ASP.NET set of class libraries containing code
    that defines objects used to create Web
    applications
  • Web application project contains all the related
    files in a Web application

7
Introduction to ASP.NET
  • ASP text file
  • Has an .asp extension
  • Contains ASP server-side script commands
    interleaved with HTML tags, Web page elements,
    and client-side script commands
  • ASP had a number of limitations
  • To address these, Microsoft developed ASP.NET
    pages, which are also called ASPX pages or Web
    forms
  • Web form text file with an .aspx file extension
    that contains Web page elements

8
An Overview of ASP.NET Server Controls
  • HTML designers responsible for the HTML
    components of an application
  • Web programmers responsible for the program
    components, such as the client-side scripts and
    server-side programs
  • Server control
  • An element that an HTML designer creates in a Web
    form
  • Provides a more direct link between items on a
    Web page and programs running on the Web server

9
An Overview of ASP.NET Server Controls
  • Server controls
  • Have associated events that the Web server
    associates with user actions
  • Enable Web developers to create modular Web
    applications
  • Server-side event handler contains program
    commands that respond to events that the user
    raises on Web server controls

10
An Overview of ASP.NET Server Controls
  • The HTML tags, elements, and Web server
    definitions exist in the Web forms .aspx file
  • Commands that reference the Web server controls
    exist in a separate VB .NET program file
  • Main types of ASP.NET server controls
  • Rich server controls
  • HTML server controls
  • Validation server controls

11
The .NET Framework Class Libraries
  • The .NET framework is built on the
    object-oriented model
  • Object class defines the properties and actions
    of similar objects
  • Class defined by its properties, events, and
    methods
  • Object classes usually have a hierarchical
    structure that defines parent classes and child
    classes

12
The .NET Framework Class Libraries
  • The .NET framework defines all of its elements
    using similar object classes, which are called
    namespaces
  • Figure 6-6 shows the ASP.NET namespace hierarchy

13
The .NET Framework Class Libraries
  • The .NET framework arranges its namespaces
    hierarchically using parent and child classes
  • Dot syntax is used to reference child classes
    within parent classes
  • parent_class.child_class

14
Creating a Web Application Project
  • Visual Studio .NET can create and configure Web
    application projects allowing developers to
    manage and control all of the application files
  • When a new Web application project is created in
    Visual Studio .NET, the IDE automatically creates
    a project folder in a physical directory
  • Visual Studio .NET also automatically creates a
    Web server application that it associates with
    the project folder

15
Configuring the Web Server for Web Application
Projects
  • Application root Web server application whose
    associated folder contains the project folders
    for the Web application projects that are being
    created
  • To configure the application root, a Web server
    application must be created and associated with
    every folder in the folder path to the
    application root

16
Creating Web Application Projects
  • Project consists of multiple files that comprise
    a Web application
  • Project files
  • Solution consists of one or more projects
  • Global files visible to all project components
  • Resource files data that supports the project
  • Project files contain information about the
    project structure and contents

17
Creating Web Application Projects
  • A project consists of one or more Web forms
  • Each Web form has an associated code behind file,
    containing code that Web developers create to
    interact with the Web forms server controls
  • By default, Visual Studio .NET places all new
    project folders in the default Visual Studio
    Projects folder

18
The Visual Studio .NET Integrated Development
Environment
19
The Visual Studio .NET Integrated Development
Environment
  • The main Web application project IDE windows
    include
  • Solution Explorer Window lists the Web
    application project components
  • Web Browser Window displays the design area and
    code window for the project's Web forms
  • Toolbox used to add elements to a Web form such
    as rich server controls, HTML server controls,
    and HTML elements
  • Properties Window lists the properties of the
    object that is currently active

20
The Solution Explorer
  • When a Web application project is created or
    opened in Visual Studio .NET, the Solution
    Explorer displays the project and its components
    as a hierarchical tree
  • This tree contains a node to represent each open
    project, and nodes below the project to represent
    the project components
  • The Solution Explorer window is used to add and
    remove project items

21
The Web Browser Window
  • The Web Browser Window where you create and view
    HTML documents and write code for client-side
    scripts
  • Displays Web forms in Design view and HTML view
  • Design view shows the form and its components
    visually
  • A grid appears on the Web form display in the Web
    Browser Window
  • This grid is used to align form objects

22
The Web Browser Window
23
The Toolbox
  • To add rich server controls, HTML server
    controls, and HTML elements to a Web form, a
    developer can select a tool in the Toolbox and
    draw the associated control on the Web form in
    Visual view

24
The Toolbox
  • Toolbox contains tools to create controls and
    other objects on Web forms
  • Default Toolbox tabs
  • Data
  • Web Forms
  • Components
  • HTML
  • Clipboard Ring
  • General

25
The Properties Window
  • Properties Window lists the properties and their
    current design time values for the project
    component that is selected in the Solution
    Explorer or for the Web form item that is
    selected in the Web Browser Window in Visual view
  • Categorized button shows the property names
    under nodes that represent different property
    categories

26
The Properties Window
  • Alphabetic button shows properties in an
    alphabetized list
  • Property Pages button opens a dialog box
    containing tab pages that allow the developer to
    set property values

27
Working With Project Components
  • HTML designers use Web form controls and other
    Web page elements to create the visual elements
    that appear on a Web page
  • After creating a Web form control, you can modify
    the controls properties to specify how the
    control looks and behaves when the form first
    opens
  • Then you can write the code behind the controls
    to modify control properties at run time and
    perform server-side processing

28
Creating Web Form Controls
  • To create a rich server control on a Web form,
    the desired control is selected in the Visual
    Studio .NET Toolbox, dragged onto the form in
    Visual view, and then repositioned and resized

29
Creating Web Form Controls
  • Web forms uses a grid layout style so that
    Visual Studio .NET specifies the elements
    location on the form using an absolute position
  • Absolute position elements location from top
    left using values in the elements style tag

30
Modifying Web Form Properties
  • To change a controls design time property
    values
  • Control is selected in the Browser Window
  • Property values are changed in the Properties
    Window
  • ID property specifies how the Web form
    internally references the control
  • Every Web form control must have a unique ID value

31
Modifying Web Form Properties
  • Dynamic controls controls whose properties
    change while the form is running
  • Because Web programmers reference dynamic
    controls in program commands, it is important to
    assign descriptive ID attribute values to them
  • Both Label and TextBox rich server controls have
    a Text property that specifies the text that the
    control displays when the form first opens

32
Writing Server-Side Web Form Programs
  • Every Web form has an associated code behind file
    that contains the code that works with the Web
    form controls
  • The code behind file is edited in the Browser
    Windows Code editor

33
Writing Server-Side Web Form Programs
34
Writing Server-Side Web Form Programs
  • Code editor an environment to enter, display,
    and edit program commands or text filesĀ 
  • Code behind file contains VB .NET commands that
    define and process Web form components
  • Declarations block
  • First set of commands in the code behind file
  • Contains the commands that define the Web form
    and its components

35
Writing Server-Side Web Form Programs
  • Code behind file also contains procedures, which
    are self-contained code blocks written in one of
    the .NET programming languages
  • Procedures can be functions and event handlers
  • VB .NET procedures can also be subroutines, which
    are similar to functions and can receive and
    manipulate parameter values, but do not return a
    specific value

36
Building and Testing the Project
  • Building the project translates the project
    files into machine-readable code that the Web
    server can execute
  • Every time a change is made to a project, the
    project assembly file must be rebuilt
  • Build Solution or Rebuild Solution to rebuild
    the project
  • Another way to build or rebuild the project files
    is to run the project in the Visual Studio .NET
    IDE

37
Building and Testing the Project
  • Visual Studio .NET Debugger to set breakpoints,
    step through commands, and view variable values
    during execution
  • Project Start Page must be specified before
    running a project in Visual Studio .NET

38
Accessing and Referencing Web Forms
  • Users can access a Web form by entering the
    forms URL in the Address field in their Web
    browser
  • Users can access Web forms through hyperlinks in
    static Web pages

39
Moving Web Application Projects to Different
Locations
  • When a project is moved to a new location, some
    modifications must be made both to the project
    and to the Web server structure
  • To move a project to a new location successfully,
    a new Web server application must be created and
    it must be associated with the new project folder
  • Then the project solution file needs to be
    modified to specify the URL to the new Web server
    application

40
Summary
  • .NET framework set of code, objects, and
    standards for building computer applications
  • ASP.NET can be used to create a Web application
    project that contains all of the applications
    related files
  • Visual Studio .NET IDE provides a visual
    interface to access, configure, manage, and debug
    the different application components in a single
    integrated environment

41
Summary
  • Server controls elements that an HTML designer
    creates in a Web form
  • Server controls enable Web developers to create
    modular Web applications
  • The .NET framework is built on the
    object-oriented model and contains an extensive
    class library
  • Visual Studio .NET stores every Web form in a
    file with an .aspx extension
Write a Comment
User Comments (0)
About PowerShow.com