ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.

Slides:



Advertisements
Similar presentations
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Advertisements

Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
 2004 Prentice Hall, Inc. All rights reserved. Chapter 21 – Web Servers (IIS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 21 – Web Servers (IIS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
Web App Development with ASP.NET. Introduction In this chapter, we introduce web-app development with Microsoft’s ASP.NET technology. Web-based apps create.
1 Chapter 12 Working With Access 2000 on the Internet.
Web Forms: Web Pages with Server Controls. 2 Objectives Understand the background of the Internet, and the notions of packet switching and a stateless.
Web-Based Applications
Chapter 1: An Introduction To ASP.NET Web Programming
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
IT 533 Lecture Notes Gül ş en Demiröz Introduction to Web Programming using ASP.NET.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College Lecture 8: WebForms — Web-based.
1 Web Servers (IIS and Apache) Outline 9.1 Introduction 9.2 HTTP Request Types 9.3 System Architecture 9.4 Client-Side Scripting versus Server-Side Scripting.
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.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Introduction to.Net and ASP.Net Course Introduction Build Your Own ASP.Net Website: Chapter 1 Microsoft ASP.Net Walkthrough: Creating a Basic Web Forms.
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Web-Based Applications Using ASP.NET
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 29.1 Multi-Tier Architecture 29.2 Web Servers.
DR.JOHN ABRAHAM PROFESSOR UTPA ASP.NET. ACTIVE SERVER PAGES (ASP) Web application development environment Web applications use web browser to display.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Object-Oriented Application Development Using VB.NET 1 Chapter 12 Web Forms, HTML, and ASP.NET.
HTML, GUI, ASP.NET Rina Zviel-Girshin Lecture 2
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Chapter 9 Programming with Web Forms Programming In Visual Basic.NET.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
IT 533 Lecture Notes Introduction to Web Programming using ASP.NET.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Module 4: Creating a Microsoft ASP.NET Web Form. Overview Creating Web Forms Using Server Controls.
Christopher M. Pascucci.NET Programming CodeBehind.
1 Web Servers (Chapter 21 – Pages( ) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System Architecture.
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.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
1111 Creating ASPX Controls Programatically Objectives You will be able to Dynamically add controls to a page. Dynamically alter properties of controls.
11 Getting Started with ASP.NET Beginning ASP.NET in C# and VB Chapters 1 and 2.
Creating a Web Site Creating a new Web site Defining and using folders Creating and editing Web pages Viewing pages in a Web browser.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Computing with C# and the .NET Framework
ASP.NET Forms.
ASP.NET Web Controls.
Web Forms, HTML, and ASP.NET
21 ASP.NET 2.0, Web Forms and Web Controls.
Web Development in Microsoft Visual Studio 2013
ASP.NET.
Introduction to Web Programming using ASP.NET
Chapter 9 Programming with Web Forms
Web Servers (IIS and Apache)
Presentation transcript:

ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web Controls Text and Graphics Controls AdRotator Control Validation Controls

Introduction Web-Based Application Development Creates Web content for Web browser clients, includes HyperText Markup Language (HTML) Client-side scripting Images and binary data Uses Web Forms, Web Controls, and C# programming Web Forms (Web Form pages) Represent what the Web page sent to client will look like File extension.aspx ASPX (Web Form files) contain written code, event handlers, utility methods and other supporting code Every ASPX file has a corresponding class written in.NET language (C#) called the code-behind file 2

Simple HTTP Transaction HyperText Transfer Protocol (HTTP) Defines methods and headers which allows clients and servers exchange information in uniform way Uniform Resource Locator (URL) IP address indicating the location of a resource All HTML documents have a corresponding URL Domain Name Server (DNS) A computer that maintains a database of hostnames and their corresponding IP addresses Microsoft Internet Information Services (IIS) Web server that programmers use when developing ASP.NET Web applications in Visual Studio 3

A Simple HTTP Transaction 4 Client interacting with Web server. Step 1: The GET request, GET /books/downloads.htm HTTP/1.1.

A Simple HTTP Transaction 5 Client interacting with Web server. Step 2: The HTTP response, HTTP/ OK or HTTP/ Not found

System Architecture Most Web-based applications are multi-tier applications Tiers are logical groupings of functionality Information Tier (data tier or bottom tier) Maintains data pertaining to the applications Usually stores data in a relational database management systems (RDBMS) Middle Tier Implements the business logic, controller logic and presentation logic Acts as an intermediary between data in the information tier and the application's clients Client Tier – application’s user interface (Web browser) 6

System Architecture 7 Three-tier architecture.

Creating and Running a Simple Web-Form Example Program consists of two related files ASPX file C# code-behind file Example Show the output Step-by-step process to create the program Present the code (much of which is generated by Visual Studio) 8

WebTime.cs Program Output 9 WebTime ouput

Creating and Running a Simple Web Form Example 10 Adding Web Form for project WebTime (Right click on project in Solution Explorer)

Creating and Running a Simple Web Form Example 11 Click on Add New Item and Add a Web Form for project WebTime.

Creating and Running a Simple Web Form Example 12 code-behind file ASPX file

Creating and Running a Simple Web Form Example 13 Solution Explorer window for project WebTime. code- behind file ASPX file

Creating and Running a Simple Web Form Example 14 Toolbox in Visual Web Developer.

Creating and Running a Simple Web Form Example 15 Source mode of Web Forms designer. Design mode button

Creating and Running a Simple Web Form Example 16 Design mode of Web Forms designer. Cursor’s current location Cursor

Creating and Running a Simple Web Form Example 17 Split mode of Web Forms designer.

Creating and Running a Simple Web Form Example 18 Code-behind file for WebTime.aspx.cs generated by Visual Web Developer.

Designing the Page Designing a Web Form as simple as a Windows Form Use Toolbox to add controls to page in Design mode Unlike working with Windows Form, type text directly on a Web Form at the cursor location or insert XHTML elements using menu commands Control and other elements are placed sequentially on a Web Form position is relative to Web Forms upper left corner Alternate type layout (absolute positioning) is discouraged 19

Designing the Page 20 WebForm.aspx after adding Label and setting its properties. label Web Form

Adding Page Logic Open WebTime.aspx.cs Add to Page_Load event handler //display the server's current time in timeLabel timeLabel.Text = DateTime.Now.ToString("hh:mm:ss"); 21

Running the Program Can view the Web Form several ways Select Debug > Start Without Debugging runs the app by opening it in a browser window If created on a local file system URL Debug>Start Debugging view web app in a web browser with debugging enabled Do you want IDE to modify the web.config file to enable debugging? Click OK To view ASPX file right click either the Web Forms Designer or the ASPX file name and select View in Browser to load the page Finally, can open web browser and type the web page’s URL in the Address field 22

WebTime.aspx Simple Web Form Example #form1 { height: 255px; width: 655px; }.style1 { font-size: large; } 23 This attribute determines how event handlers are linked to a control’s events AutoEventWireUp set to true so ASP.NET treats method of name Page_eventName as an event handler for a specified event Specify class in the code- behind file from which this ASP.NET document Document type declaration, specifies document element name and URI Title for web page Directive to specify information needed to process file

Current time on the Web Server: <asp:Label ID="timeLabel" runat="server" BackColor="Black" Font-Size="XX-Large" ForeColor="Lime"> 24 Body tag, beginning of Web page’s viewable content Attribute indicates the server processes the form and generates HTML for client The asp:Label control maps to HTML span element – markup for the Label Web control

// WebTime.aspx.cs // The code-behind file for a page that displays the Web server's time. using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; // definitions for graphical controls used in Web Forms using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; public partial class WebTime : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //display the server's current time in timeLabel timeLabel.Text = DateTime.Now.ToString("hh:mm:ss"); } 25 Contains classes that manage client requests and server responses Contain classes for creation of Web-based applications and controls Set timeLabel’s Text property to Web server’s time Event raised when Web page loads

Creating and Running a Simple Web-Form Example How are ASPX file and code-behind file used to create the Web page that is sent to the client? WebTimeTest.aspx.cs is the base class specified in the ASPX file WebTimeTest inherits from Page, which defines general functionality of a Web page Also defines some of its own functionality (displaying time) WebTime.ASPX defines the GUI When client requests an ASPX file… Class is created behind the scenes that contains both the visual aspect of our page (.aspx) and the logic of our page (.aspx.cs) New class inherits from Page First time Web page is requested, class is compiled, and instance created (put in project’s bin directory) This instance represents the page – creates the HTML sent to the client 26

Creating and Running a Simple Web-Form Example Once the web page has been created Multiple clients can use that instance (w/o recompilation) Project is recompiled only when programmer modifies the application; this is detected by the runtime environment How does it execute? When the Web server creates an instance of our page to serve a client request The Init event occurs first, invoking method OnInit This method calls InitializeComponent Then Load event is generated, which calls Page_Load Page_Load executes processing time will be updated with every page request After this event handler finishes, the page processes any events raised by page’s controls (such as button clicks). When ready for garbage collection, an UnLoad event is generated and method Page_Unload is called 27

Simple Web Form Example #form1 10 { 11 height: 255px; 12 width: 655px; 13 } 14.style1 15 { 16 font-size: large; 17 } Current time on the web server: 28 <span id="timeLabel" style="color:LimeGreen;background 29 color:Black;font-size:XX-Large;">03:10: Defines the body of the documentHidden inputs from the user Look at HTML response when browser requests WebTime.aspx span element to represent the text in the label Using Cascading Style Sheets

Instructions to get IIS and ASP.NET running First Install IIS (need Windows 7 CD) Start IIS by executing inetmgr.exe (?) Expand node representing your computer Right click Default Web Site and select Start Run C:\WINDOWS\Microsoft.NET\Framework\v4.nnnn\aspnet_regiis /i 29

Summary Instructions to Create a Web App project 1.File>New Web Site Type in project name in the Location field 2.Examine the newly created project View aspx file Click on display all files icon and expand the node for ASPX page – View code-behind file 3.Rename the ASPX file and the Class in the code-behind file 4.Design the page Change page title EnableSessionState property set to false Add labels, rename, change BackColor, ForeColor and Font-Size properties 5.Add page logic in code-behind file in Page_Load 30

Instructions to Run the Program Three ways 1.Debug>Start Without Debugging 2.Right-click Web Form designer or ASPX file name in Solution Explorer and select View In Browser 3.Open browser and type in URL 31