ASP.NET.

Slides:



Advertisements
Similar presentations
Unit 02. ASP.NET Introduction HTML & Server controls Postbacks Page Lifecycle.
Advertisements

11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
IT533 Lecture ASP.NET Controls. Installations Microsoft® SQL Server® 2008 Express.
HTML Hypertext Markup Language –First proposed by CERN in 1989 –It is non-linear so it allows you to jump from place to place –Markup refers to the structure.
Web-Based Applications
IT 533 Lecture Notes Gül ş en Demiröz Introduction to Web Programming using ASP.NET.
11 ASP.NET Controls Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
ASP.Net, Web Forms and Web Controls 1 Outline Introduction Simple HTTP Transaction System Architecture Creating and Running a Simple Web Form Example Web.
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.
Web-Based Applications Using ASP.NET
JavaScript & jQuery the missing manual Chapter 11
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introducing Web Controls Outline 29.1 Analyzing the.
Web Controls Dr. Awad Khalil Computer Science & Engineering Department AUC.
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.
ASP.NET Web Server Controls Basic Web Server Controls.
Objectives: 1. Create a Skeleton HTML 2. View a Skeleton File Through a Server and Browser 3. Learn HTML Body Tags for the Display of Text and Graphics.
IT 533 Lecture Notes Introduction to Web Programming using ASP.NET.
Microsoft Visual Basic 2008 CHAPTER SEVEN Creating Web Applications.
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.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Module 4: Creating a Microsoft ASP.NET Web Form. Overview Creating Web Forms Using Server Controls.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
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.
Asp.NET Core Server Controls. Slide 2 Lecture Overview Understanding the types of ASP.NET controls HTML controls ASP.NET (Web) controls.
11 ASP.NET Server Controls Beginning ASP.NET in C# and VB Chapter 4.
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.
HTML-I Basic HTML Elements. HTML (Hyper Text Markup Language) HTML is a document layout and hyperlink- specification language. i.e. a language used to.
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 Introducing Web Developer Tools Rapid application development tools ASP.NET-compatible web editors –Visual Studio.NET Professional Edition –Visual Studio.
Creating Consistent Looking Websites
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Visual Studio ITEC 420.
Dive Into® Visual Basic 2010 Express
Computing with C# and the .NET Framework
ASP.NET Forms.
Working with ASP.NET Server Controls
ASP.NET Web Controls.
 2009 Pearson Education, Inc. All rights reserved.
Web Forms, HTML, and ASP.NET
Chapter 8 User Controls.
21 ASP.NET 2.0, Web Forms and Web Controls.
Introduction to Client-Server Programming
Chapter 2 – Introduction to the Visual Studio .NET IDE
ASP.NET Web Controls.
Visual programming Chapter 1: Introduction
Web Development in Microsoft Visual Studio 2013
ASP.Net Demo ISYS 350.
Social Media And Global Computing Introduction to Visual Studio
Introducing ASP.net with Visual Studio Environment
Static and Dynamic Web Pages
Web Development Using ASP .NET
Introduction to Web Programming using ASP.NET
Understand basic HTML and CSS terminology, concepts, and basic operations. Objective 3.01.
E-commerce Applications Development
Basic HTML Workshop.
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
Programming with Microsoft Visual Basic 2008 Fourth Edition
Presentation transcript:

ASP.NET

Rule One: Our client is always right Rule One: Our client is always right. Rule Two: If you think our client is wrong, see Rule One. Anonymous

25.1 Introduction ASP.NET 2.0 and Web Forms and Controls Web application development with Microsoft’s ASP.NET 2.0 technology Web Form files have the filename extension .aspx and contain the Web page’s GUI Every ASPX file created in Visual Studio has a corresponding class written in a .NET language, such as Visual Basic/ C# Contains event handlers, initialization code, utility methods and other supporting code Called the code-behind file Provides the ASPX file’s programmatic implementation

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)

WebTime.cs Program Output WebTime ouput WebTime.cs Program Output

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

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

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

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

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

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

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

Creating and Running a Simple Web Form Example 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 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

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

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");

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 http://localhost:PortNumber/WebTime/WebTime.aspx 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 Finally, can open web browser and type the web page’s URL in the Address field

WebTime.aspx Directive to specify information needed to process file This attribute determines how event handlers are linked to a control’s events <%-- Fig. 22.4: WebTime.aspx --%> <%-- A page that displays the current time in a Label. --%> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebTime.aspx.cs" Inherits="WebTime" EnableSessionState="False" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Simple Web Form Example</title> <style type="text/css"> #form1 { height: 255px; width: 655px; } .style1 font-size: large; </style> </head> 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

<form id="form1" runat="server"> <div> Body tag, beginning of Web page’s viewable content <body> <form id="form1" runat="server"> <div> <h2> Current time on the Web Server:</h2> <p>  </p> </div> <asp:Label ID="timeLabel" runat="server" BackColor="Black" Font-Size="XX-Large" ForeColor="Lime"></asp:Label> </form> </body> </html> 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

// definitions for graphical controls used in Web Forms // 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"); } Contains classes that manage client requests and server responses Contain classes for creation of Web-based applications and controls Event raised when Web page loads Set timeLabel’s Text property to Web server’s time

25.2.1 Examining an ASPX File Examining an ASPX File ASP.NET comments begin with <%-- and terminate with --%> Page directive Specifies the language of the code-behind file ASP.NET markup is not case-sensitive, so using a different case is not problematic

25.2.1 Examining an ASPX File asp: tag prefix in a control declaration runat attribute Indicates that when a client requests this ASPX file: Process the head element and its nested elements on the server Generate the corresponding XHTML Sent to the client asp: tag prefix in a control declaration Indicates that it is an ASP.NET Web control Each Web control maps to a corresponding XHTML element When processing a Web control, ASP.NET generates XHTML markup that will be sent to the client to represent that control in a Web browser span element Contains text that is displayed in a Web page

Outline ASP.NET comments WebTime.aspx Page directive to specify information needed by ASP.NET to process this file Document type declaration Mark up of a label web control

Retrieves the current time and formats it as hh:mm:ss Outline WebTime.aspx.vb Retrieves the current time and formats it as hh:mm:ss

25.2.5 Examining the XHTML Generated by an ASP.NET Application XHTML forms can contain visual and nonvisual components Attribute method Specifies the method by which the Web browser submits the form to the server Attribute action Identifies the name and location of the resource that will be requested when this form is submitted The runat attribute is removed when the form is processed on the server The method and action attributes are added The resulting XHTML form is sent to the client browser

Outline Declaration for a non-visual component: hidden input WebTime.html Declaration for a non-visual component: hidden input Represents the text in the label

Web Controls

25.3.1 Text and Graphics Controls

Set the color of a specific piece of text Outline WebControls.aspx (1 of 5) Set the color of a specific piece of text

Define a TextBox control used to collect the user’s first name Outline WebControls.aspx (2 of 5) Define a TextBox control used to collect the user’s first name

Outline Defines a DropDownList (3 of 5) WebControls.aspx (3 of 5) Each item in the drop-down list is defined by a ListItem element Adds a hyperlink to the web page

Outline (4 of 5) Defines a RadioButtonList control WebControls.aspx (4 of 5) Defines a RadioButtonList control Each item in the drop-down list is defined by a ListItem element Defines a Button web control

Outline WebControls.aspx (5 of 5)

Fig. 25.14 | DropDownList Tasks smart tag menu.