introduction to asp.net t.ahlam algharasi. the visual studio ide start page 2

26
Introduction to ASP.NET T.Ahlam Algharasi

Upload: jane-beryl-caldwell

Post on 02-Jan-2016

229 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

Introduction to ASP.NET

T.Ahlam Algharasi

Page 2: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.2

The Visual Studio IDE

• Start page

Page 3: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.3

Websites in Visual Studio• Create a new ASP.NET application.

Page 4: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.4

Websites in Visual Studio

• The New Web Site window

Page 5: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.5

Websites in Visual Studio

• The New Web Site window allows you to specify three details:

– Template: The template determines what files your website starts with. Visual Studio supports two types of basic ASP.NET applications: web site applications and web service applications.

– Location: The location specifies where the website files will be stored.

– Language: The language identifies the .NET programming language you’ll use to code your website.

Page 6: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.6

The Visual Studio IDE

21

3

4

Page 7: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.7

The Visual Studio IDEDescription Windows

Lists the files and subfolders that are in the web application folder.

Solution Explorer

Shows ASP.NET’s built-in server controls and any third- party controls or custom controls that you build yourself and add to the Toolbox. Controls can be written in any language and used in any language.

Toolbox

Allows you to configure the currently selected element, whether it’s a file in the Solution Explorer or a control on the design surface of a web form.

Properties

Reports on errors that Visual Studio has detected in your code but that you haven’t resolved yet.

Error List

Page 8: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.8

Solution Explorer

• It allows you to see the files that are in the web application directory.

• ASP.NET File Types

Description File

These are ASP.NET web pages .They contain the user interface and, optionally, the underlyingapplication code.

Ends with .aspx

These are ASP.NET user controls. User controls are similar to web pages, except that they can’t be accessed directly. User controls allow you to develop an important piece of the user interface and reuse it in as many web forms as you want without repetitive code.

Ends with .ascx

Page 9: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.9

Solution Explorer• ASP.NET File Types

Description File

This is the XML-based configuration file for your ASP.NET application. It includes settings for customizing security, memory management, and much more.

web.config

These are ASP.NET web services. Web services work differently than web pages, but they still share the same application resources, configuration settings, and memory.

Ends with .asmx

These are code-behind files that contain vb code. They allow you to separate the application from the user interface of a web page.

Ends with .vb

Page 10: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

Solution Explorer

• “App_Data” Folder

– This directory is reserved for data storage, including

database files , XML files, and other data store files. Of

course, you’re free to store data files in other directories.

05.10

Page 11: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.11

Toolbox Tabs

Description Tab

This tab includes the rich web server controls that are the heart of ASP.NET’s web form model.

Standard

These components allow you to connect to a database. Data

These controls allow you to verify an associated input control against user-defined rules. For example, you can specify the input can’t be empty, it must be a number, it must be greater than a certain value, and so on.

Validation

These controls are designed to display site maps and allow the user to navigate from one page to another.

Navigation

These controls provide prebuilt security solutions, such as login boxes and a wizardfor creating users.

Login

Page 12: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.12

Toolbox Tabs

• You can customize both the tabs and the items in each tab. – To modify the tab groups, right-click a tab heading, and select

Rename Tab, Add Tab, or Delete Tab. – To add an item, right-click the blank space on the Toolbox, and

Select Items. You can also drag items from one tab group to another.

Description Tab

This tab allows you to drag and drop static HTML elements. HTML

Provides a repository for code snippets and control objects. Just drag and drop them here, and pull them off when you need to use them later.

General

Page 13: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.13

Code Debugging

• To test this page, select Debug Start Debugging from the ➤menu. Because this is the first time running any page in this application, Visual Studio will inform you that you need a configuration file that specifically enables debugging

• Click OK to add this configuration file.

ASP.net Server

Page 14: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.14

The Coding Model

• Visual Studio supports two models for coding web pages and web services:

– Code-behind• This model separates each ASP.NET web page into two

files: an .aspx markup file with the HTML and control tags, and a .vb code file with the source code for the page.• This model provides better organization• important when building complex pages.

Page 15: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.15

The Coding Model

Code-behind Example “Default.aspx” Page

Page 16: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.16

The Coding Model

Code-behind Example “Default.aspx.vb” Page

Page 17: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.17

The Coding Model

– Inline code • This model is the closest to traditional ASP. All the code

and HTML is stored in a single .aspx file. The code is embedded in one or more script blocks. • it’s popular for coding simple web pages.

Page 18: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.18

The Coding Model Inline code Example

Page 19: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.19

Choosing the coding model

• When you add a new web page to your website (using Website Add New Item), the Place Code in a Separate File check box ➤

chooses whether you want to use the code-behind model or not.

Page 20: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.20

Web Forms • The term used to describe an ASP.NET web page is web form.

– The basic structure of a web form is shown here:

Page 21: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

Controls

Page 22: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.22

Server Controls

• Server controls– are a fundamental part of the ASP.NET architecture.– are tags that are understood by the server.

• There are three kinds of server controls:– HTML Server Controls - Traditional HTML tags – Web Server Controls - New ASP.NET tags – Validation Controls - For input validation

Page 23: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.23

Server Controls

• HTML Server Controls

– HTML server controls are standard

HTML tags and are declared with

the runat="server" attribute.

– The runat="server" attribute

indicates that the form should be

processed on the server.

Page 24: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.24

Server Controls

• Web Server Controls

– These classes duplicate the functionalities of the

basic HTML tags but have a more consistent and

meaningful set of properties and methods that

make it easier for the developer to declare and

access them.

Page 25: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

05.25

Server Controls

• Validation Controls

– are used to validate user-input. For Example If the user-

input does not pass validation, it will display an error

message to the user.

Page 26: Introduction to ASP.NET T.Ahlam Algharasi. The Visual Studio IDE Start page 2

Questions

05.26