32
Web Programming Building ASP.NET Applications T. Ahlam Algharasi 4 th Level

Web Programming

Embed Size (px)

DESCRIPTION

Web Programming. Building ASP.NET Applications. T. Ahlam Algharasi 4 th Level. Standard Controls. Label Control The Label control is one of the primary output controls. - PowerPoint PPT Presentation

Citation preview

Page 1: Web Programming

Web ProgrammingBuilding ASP.NET Applications

T. Ahlam Algharasi4th Level

Page 2: Web Programming

2

Standard Controls

Label Control

The Label control is one of the primary output controls.

It defines an area on the Web page to which output can

be written. This control can be used to display static text,

or it can be used as a dynamic output area controlled by

scripts. Description Property

The text to display in the label Text

Page 3: Web Programming

3

Standard Controls

Displaying Static Text Example

Page 4: Web Programming

4

Standard Controls

Using html Tags to format the output text .

Page 5: Web Programming

Standard Controls

05.5

Page 6: Web Programming

6

Standard Controls

Image Control Is used to place an image on the page.

Description Property

Url of image location. ImageUrl

Appears if image not loaded properly or if image is missing in the specified location.

AlternetText

Text message Appearing on mouse over the image

Tooltip

Used to align the Text beside image. ImageAlign

Page 7: Web Programming

7

Standard Controls Hyperlink Control

Is used to link to another location or page.

Description Property

Used to place an image instead of text as Hyperlink.

ImageUrl

Used to specify the location to link to. NavigateUrl

To display link as text Text

Specifying where the linked page is opened.

Target

Page 8: Web Programming

8

Standard Controls

If both Text and ImageUrl properties are set, the ImageUrl

property takes precedence and the Text property serves as

a Tool Tip. If the image is unavailable, the Text property is

displayed.

Page 9: Web Programming

9

Standard Controls

Button Control Is used to link to another location or page.

LinkButton Control displays a clickable text link

ImageButton Control displays an image that responds to mouse clicks

like a button.

Description Property

Specifies the URL of the page to post to from the current page when a button is clicked

PostBackUrl

Specifies the text on a button Text

Page 10: Web Programming

10

Standard Controls RadioButton control

Is used to give single select option to the user from multiple items.

Description Property

Form is automatically posted back when Radio button selection is changed.

AutoPostBack

true/false. If true, Radio button is selected by default.

Checked

It is used a group a set of radion buttons so only one of them can be selected at a time.

GroupName

The text next to the radio button Text

On which side of the radio button the text should appear (right or left)

TextAlign

Page 11: Web Programming

11

Standard Controls

Example

Page 12: Web Programming

12

Standard ControlsExample of Automatic Post-Back

Page 13: Web Programming

13

Standard Controls RadioButtonList control

is a single control that groups a collection of radio buttons.

Description Property

The value of the selected item in a list SelectedValue

The index number of the selected item in a list

SelectedIndex

A collection of list items in the list Items

On which side of the radio button the text should appear (right or left)

TextAlign

Specifies whether the radio button group should be repeated horizontally or vertically

RepeatDirection

Page 14: Web Programming

14

Standard Controls

Example

Page 15: Web Programming

15

Standard Controls

CheckBox control is used to give an option to the user.

Description Property

A Boolean value that specifies whether the form should be posted immediately after the Checked property has changed or not. Default is false

AutoPostBack

true/false. If true, Check box is checked by default.

Checked

A collection of list items in the list Items

On which side of the radio button the text should appear (right or left)

TextAlign

Page 16: Web Programming

16

Standard Controls

CheckBoxList control is a single control that groups a collection of checkable list

items.

Description Property

A Boolean value that specifies whether the form should be posted immediately after the Checked property has changed or not. Default is false

AutoPostBack

true/false. If true, Check box is checked by default.

Checked

Get the first selected item SelectedItem

A collection of list items in the list Items

On which side of the radio button the text should appear (right or left)

TextAlign

Horizontal/Vertical. RepeatDirection

Page 17: Web Programming

17

Standard Controls DropDownList control

is used to give a single select option to the user from multiple listed items.

ListBox control ListBox control is used to give a single or multiple select

option to the user.

Description Property

No. of rows (items) can be set to display in the List.

Rows

Single or Multiple. If multiple, it allows user to select multiple items from the list by holding Ctrl or Shift key.

SelectionMode

Page 18: Web Programming

Standard Controls

Example

05.18

Page 19: Web Programming

19

Standard Controls

ImageMap control is used to create an image that contains clickable hotspot

region.

Description Property

Url of image location. ImageUrl

Appears if image not loaded properly AlternetText

Appears when on mouse over the image Tooltip

define any number of hot spot regions within the image

HotSpots

Page 20: Web Programming

20

Standard Controls

Creating an Image Map An image map can be created from any graphic image by

defining rectangular, circular, or polygonal shapes overlying portions of the image. These shapes become the clickable hot spots to issue URL navigations or subprogram calls.

The information needed to define these shapes are Rectangle - the pixel coordinates of the top-left and

bottom-right corners

Circle - the pixel coordinates of the center and its radius

Polygon - the pixel coordinates of each corner point

Page 21: Web Programming

21

Standard Controls

Image Map Coordinates

Page 22: Web Programming

Standard Controls

Rectangle - left-top : 49,36; right-bottom : 216,148

Circle - center:368,200; radius:76

Polygon - corner points: 143,187 237,249 222,333 107,333 76,254

05.22

Image Map Coordinates

Page 23: Web Programming

23

ASP.NET Web Forms

All server controls must appear within a <form> tag, and the <form> tag must contain the runat="server" attribute.

The form is always submitted to the page itself.

If you omit the method attribute, it will be set to method="post" by default.

<form runat="server">

...HTML + server controls

</form>

Page 24: Web Programming

24

ASP.NET Web Forms

Request Object

The Request object can be used to retrieve user information

from forms.

User input can be retrieved with the Request.QueryString or

Request.Form command.

1. Request.QueryString

The Request.QueryString command is used to collect

values in a form with method="get".

Information sent from a form with the GET method is

visible to everyone (it will be displayed in the browser's

address bar) and has limits on the amount of information

to send.

Page 25: Web Programming

25

ASP.NET Web Forms

2. Request.Form

The Request.Form command is used to collect values in a

form with method="post".

Information sent from a form with the POST method is

invisible to others and has no limits on the amount of

information to send.

Syntax:

Request.Form (Control_ID)

Request.QueryString(Control_ID)

Page 26: Web Programming

26

ASP.NET Web Forms Example of sending information using “Post” Method

First Page

Second Page

Page 27: Web Programming

27

ASP.NET Web Forms Code

First Page

Default method is post

Page 28: Web Programming

28

ASP.NET Web Forms Code

Second Page

Page 29: Web Programming

29

ASP.NET Web Forms Example of sending information using “Get” Method

First Page

Second Page

Page 30: Web Programming

30

ASP.NET Web Forms Code

First Page

Method is Get

Page 31: Web Programming

31

ASP.NET Web Forms Code

Second Page

Page 32: Web Programming

Questions