21 ASP.NET 2.0, Web Forms and Web Controls.

Slides:



Advertisements
Similar presentations
 2004 Prentice Hall, Inc. All rights reserved. Chapter 23 – ASP.NET Outline 23.1 Introduction 23.2.NET Overview NET Framework ASP (Active.
Advertisements

Forms Authentication, Users, Roles, Membership Ventsislav Popov Crossroad Ltd.
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
 2006 Pearson Education, Inc. All rights reserved ASP.NET 2.0, Web Forms and Web Controls.
Automating Tasks With Macros
Building ASP.NET Applications 2 Lecture 3,4 T. Ahlam Algharasi 4 th Level.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
Chapter 9 Web Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Building an ASP.NET Web Application Dr. Awad Khalil Computer Science & Engineering Department AUC.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Web Application Introducing Visual Web Developer 2008 Express and the.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 10 Managing Data with ASP.NET. ASP.NET 2.0, Third Edition2.
Forms Authentication, Users, Roles, Membership Svetlin Nakov Telerik Corporation
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Tutorial 10 Adding Spry Elements and Database Functionality Dreamweaver CS3 Tutorial 101.
IT533 Lectures Session Management in ASP.NET. Session Tracking 2 Personalization Personalization makes it possible for e-businesses to communicate effectively.
IT533 Lectures Security. Reasons for Security Prevent access to areas of your Web server Record and store secure relevant user data Security Configuration.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introducing Web Controls Outline 29.1 Analyzing the.
 2008 Pearson Education, Inc. All rights reserved ASP.NET 2.0 and ASP.NET Ajax.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Chapter 2 – Introduction to the Visual Studio .NET IDE
 2008 Pearson Education, Inc. All rights reserved ASP.NET 2.0 and ASP.NET Ajax.
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
1 Web Servers (Chapter 21 – Pages( ) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System Architecture.
ASP.Net, Web Forms and Web Controls 1 Outline Session Tracking Cookies Session Tracking with HttpSessionState.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Application: Middle Tier Introducing Code-Behind Files, Session State.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Web Application: Client Tier Introducing Web Controls.
IT533 Lectures ASP.NET AJAX.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Working with ASP.NET Controls What is ASP.NET Using server controls in your pages Allowing users to create their own accounts Creating a login page Letting.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Getting Started with Dreamweaver
Computing with C# and the .NET Framework
 2009 Pearson Education, Inc. All rights reserved.
ASP.NET Forms.
Running a Forms Developer Application
ASP.NET Web Controls.
Working in the Forms Developer Environment
Chapter 2 – Introduction to the Visual Studio .NET IDE
ASP.NET Web Controls.
Chapter 19 PHP Part III Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
Section 17.1 Section 17.2 Add an audio file using HTML
25 ASP.NET 2.0 and ASP.NET Ajax.
Chapter 23 – ASP.NET Outline 23.1 Introduction NET Overview
Web Development in Microsoft Visual Studio 2013
Social Media And Global Computing Introduction to Visual Studio
CIS16 Application Development Programming with Visual Basic
Getting Started with Dreamweaver
Cascading Style Sheets™ (CSS)
ASP.NET.
PART 2.
Web Development Using ASP .NET
An Introduction to JavaScript
Programming with Microsoft Visual Basic 2008 Fourth Edition
Presentation transcript:

21 ASP.NET 2.0, Web Forms and Web Controls

A fair question should be followed by a deed in silence. If any man will draw up his case, and put his name at the foot of the first page, I will give him an immediate reply. Where he compels me to turn over the sheet, he must wait my leisure. Lord Sandwich Rule One: Our client is always right Rule Two: If you think our client is wrong, see Rule One. Anonymous A fair question should be followed by a deed in silence. Dante Alighieri

You will come here and get books that will open your eyes, and your ears, and your curiosity, and turn you inside out or outside in. Ralph Waldo Emerson

OBJECTIVES In this chapter you will learn: Web application development using ASP.NET. To create Web Forms. To create ASP.NET applications consisting of multiple Web Forms. To maintain state information about a user with session tracking and cookies. To use the Web Site Administration Tool to modify Web application configuration settings. To control user access to Web applications using forms authentication and ASP.NET login controls. To use databases in ASP.NET applications. To design a master page and content pages to create a uniform look-and-feel for a Web site.

21.1 Introduction 21.2 Simple HTTP Transactions 21.3 Multitier Application Architecture 21.4 Creating and Running a Simple Web-Form Example 21.4.1 Examining an ASPX File 21.4.2 Examining a Code-Behind File 21.4.3 Relationship Between an ASPX File and a Code- Behind File 21.4.4 How the Code in an ASP.NET Web Page Executes 21.4.5 Examining the XHTML Generated by an ASP.NET Application 21.4.6 Building an ASP.NET Web Application 21.5 Web Controls 21.5.1 Text and Graphics Controls 21.5.2 AdRotator Control 21.5.3 Validation Controls

21.6 Session Tracking 21.6.1 Cookies 21.6.2 Session Tracking with HttpSessionState 21.7 Case Study: Connecting to a Database in ASP.NET 21.7.1 Building a Web Form That Displays Data from a Database 21.7.2 Modifying the Code-Behind File for the Guestbook Application 21.8 Case Study: Secure Books Database Application 21.8.1 Examining the Completed Secure Books Database Application 21.8.2 Creating the Secure Books Database Application 21.9 Wrap-Up 21.10 Web Resources

Fig. 21. 1 | Client interacting with Web server Fig. 21.1 | Client interacting with Web server. Step 1: The GET request.

Fig. 21. 2 | Client interacting with Web server Fig. 21.2 | Client interacting with Web server. Step 2: The HTTP response.

Fig. 21.3 | Three-tier architecture.

Outline WebTime.aspx

Portability Tip 21.1 The same Web control can map to different XHTML elements, depending on the client browser and the Web control’s property settings.

Outline WebTime.aspx.cs (1 of 2)

Outline WebTime.aspx.cs (2 of 2)

Performance Tip 21.1 Once an instance of the Web page has been created, multiple clients can use it to access the page—no recompilation is necessary. The project will be recompiled only when you modify the application; changes are detected by the runtime environment, and the project is recompiled to reflect the altered content.

Outline WebTime.html

Fig. 21.7 | Creating an ASP.NET Web Site in Visual Web Developer.

Fig. 21.8 | Solution Explorer window for project WebTime. Code-behind file Properties Refresh Nest Related Files View Code View Designer Copy Web Site ASP.NET Configuration ASPX file Fig. 21.8 | Solution Explorer window for project WebTime.

Fig. 21.9 | Toolbox in Visual Web Developer.

Fig. 21.10 | Source mode of the Web Forms Designer. Design mode button Source mode button Fig. 21.10 | Source mode of the Web Forms Designer.

Fig. 21.11 | Design mode of the Web Forms Designer. Cursor Cursor’s current location Fig. 21.11 | Design mode of the Web Forms Designer.

Fig. 21. 12 | Code-behind file for Default Fig. 21.12 | Code-behind file for Default.aspx generated by Visual Web Developer.

Portability Tip 21.2 Absolute positioning is discouraged, because pages designed in this manner may not render correctly on computers with different screen resolutions and font sizes. This could cause absolutely positioned elements to overlap each other or display off-screen, requiring the client to scroll to see the full page content.

Fig. 21.13 | WebTime.aspx after inserting text and a new paragraph. Cursor position after inserting text and a new paragraph by pressing Enter Block Format drop-down list Fig. 21.13 | WebTime.aspx after inserting text and a new paragraph.

Label Fig. 21.14 | WebTime.aspx after adding a Label and setting its properties.

Fig. 21.15 | Commonly used Web controls.

Outline WebControls.aspx (1 of 6)

Outline WebControls.aspx (2 of 6)

Outline WebControls.aspx (3 of 6)

Outline WebControls.aspx (4 of 6)

Outline WebControls.aspx (5 of 6)

Outline (6 of 6) WebControls.aspx Image control TextBox control DropDownList control HyperLink control RadioButtonList control Button control WebControls.aspx (6 of 6)

Fig. 21.17 | DropDownList Tasks smart tag menu.

Outline FlagRotator.aspx (1 of 2)

Outline (2 of 2) FlagRotator.aspx (a) (b) AdRotator image AlternativeText displayed in a tooltip (b) (c) FlagRotator.aspx (2 of 2)

Outline AdRotator Information.xml (1 of 4)

Outline AdRotator Information.xml (2 of 4)

Outline AdRotator Information.xml (3 of 4)

Outline AdRotator Information.xml (4 of 4)

Outline Validation.aspx (1 of 6)

Outline Validation.aspx (2 of 6)

Outline Validation.aspx (3 of 6)

Outline Validation.aspx (4 of 6)

Outline (a) (b) Validation.aspx (5 of 6)

Outline (c) (d) Validation.aspx (6 of 6)

Outline Validation.aspx.cs (1 of 2)

Outline Validation.aspx.cs (2 of 2)

Performance Tip 21.2 Setting EnableViewState to False reduces the amount of data passed to the Web server with each request.

Outline Validation.html (1 of 9)

Outline Validation.html (2 of 9)

Outline Validation.html (3 of 9)

Outline Validation.html (4 of 9)

Outline Validation.html (5 of 9)

Outline Validation.html (6 of 9)

Outline Validation.html (7 of 9)

Outline Validation.html (8 of 9)

Outline Validation.html (9 of 9)

Portability Tip 21.3 Clients may disable cookies in their Web browsers to ensure that their privacy is protected. Such clients will experience difficulty using Web applications that depend on cookies to maintain state information.

Outline Options.aspx (1 of 4)

Outline Options.aspx (2 of 4)

Outline (a) Options.aspx (3 of 4) (b)

Outline (c) Options.aspx (4 of 4) (d)

Outline Options.aspx.cs (1 of 3)

Outline Options.aspx.cs (2 of 3)

Outline Options.aspx.cs (3 of 3)

Outline Recommendations .aspx (1 of 2)

Outline Recommendations .aspx (2 of 2)

Outline Recommendations .aspx.cs (1 of 2)

Outline Recommendations .aspx.cs (2 of 2)

Fig. 21.27 | HttpCookie properties.

Outline Options.aspx (1 of 4)

Outline Options.aspx (2 of 4)

Outline (a) Options.aspx (3 of 4) (b)

Outline (c) Options.aspx (4 of 4) (d)

Software Engineering Observation 21.1 A Web Form should not use instance variables to maintain client state information, because each new request or postback, is handled by a new instance of the page. Web Forms should maintain client state information in HttpSessionState objects, because such objects are specific to each client.

Outline Options.aspx.cs (1 of 3)

Outline Options.aspx.cs (2 of 3)

Outline Options.aspx.cs (3 of 3)

Software Engineering Observation 21.2 One of the primary benefits of using HttpSessionState objects (rather than cookies) is that HttpSessionState objects can store any type of object (not just Strings) as attribute values. This provides you with increased flexibility in determining the type of state information to maintain for clients.

Fig. 21.30 | HttpSessionState properties.

Outline Recommendations .aspx (1 of 2)

Outline Recommendations .aspx (2 of 2)

Outline Recommendations .aspx.cs (1 of 2)

Outline Recommendations .aspx.cs (2 of 2)

Fig. 21.33 | Guestbook application GUI in Design mode. GridView control Fig. 21.33 | Guestbook application GUI in Design mode.

Fig. 21.34 | Change Data Source dialog in Visual Web Developer.

Fig. 21.35 | Configuring the SELECT statement used by the SqlDataSource to retrieve data.

Fig. 21.36 | Previewing the data retrieved by the SqlDataSource.

SqlDataSource control Fig. 21.37 | Design mode displaying SqlDataSource control for a GridView.

Fig. 21.38 | Removing the MessageID column from the GridView.

Fig. 21.39 | Setting up INSERT parameters based on control values.

Outline Guestbook.aspx (1 of 7)

Outline Guestbook.aspx (2 of 7)

Outline Guestbook.aspx (3 of 7)

Outline Guestbook.aspx (4 of 7)

Outline Guestbook.aspx (5 of 7)

Outline (a) Guestbook.aspx (6 of 7)

Outline (b) Guestbook.aspx (7 of 7)

Outline Guestbook.aspx.cs (1 of 2)

Outline Guestbook.aspx.cs (2 of 2)

Fig. 21.42 | Login.aspx page of the secure books database application.

Fig. 21.43 | CreateNewUser.aspx page of the secure book database application.

Fig. 21.44 | Message displayed to indicate that a user account was created successfully.

Fig. 21.45 | Books.aspx displaying books by Harvey Deitel (by default).

Fig. 21.46 | Books.aspx displaying books by Andrew Goldberg.

Fig. 21.47 | Logging in using the Login control.

Fig. 21.48 | Error message displayed for an unsuccessful login attempt using the Login control.

Fig. 21.49 | Web Site Administration Tool for configuring a Web application.

Fig. 21.50 | Security page of the Web Site Administration Tool.

Fig. 21. 51 | Choosing the type of authentication used by an ASP Fig. 21.51 | Choosing the type of authentication used by an ASP.NET Web application.

Fig. 21.52 | Main page of the Web Site Administration Tool after enabling forms authentication.

Fig. 21.53 | Add New Access Rule page used to configure directory access.

Fig. 21.54 | Master page in Source mode.

Fig. 21.55 | Master page in Design mode.

Outline Bug2Bug.master (1 of 2)

Outline Bug2Bug.master (2 of 2)

Fig. 21.57 | Content page CreateNewUser.aspx in Source mode.

Fig. 21.58 | Content page CreateNewUser.aspx in Design mode.

Outline CreateNewUser.aspx (1 of 3)

Outline CreateNewUser.aspx (2 of 3) (a) (b)

Outline (c) CreateNewUser.aspx (3 of 3)

Outline Login.aspx (1 of 2)

Outline (a) (b) Login.aspx (2 of 2)

Fig. 21.61 | Authors DataTable in the Dataset Designer.

Fig. 21.62 | Query Builder for designing a query that selects books written by a particular author.

Fig. 21.63 | Dataset Designer after adding the TitlesTableAdapter.

Fig. 21.64 | Choosing a business object for an ObjectDataSource.

Fig. 21.65 | Choosing a data method of a business object for use with an ObjectDataSource.

Fig. 21.66 | Choosing a data source for a DropDownList.

Fig. 21.67 | Choosing the data source for a parameter in a business object’s data method.

Fig. 21.68 | Completed Books.aspx in Design mode.

Outline Books.aspx (1 of 5)

Outline Books.aspx (2 of 5)

Outline (a) Books.aspx (3 of 5)

Outline (b) Books.aspx (4 of 5)

Outline (c) Books.aspx (5 of 5)