+ All Categories
Home > Documents > ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator...

ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator...

Date post: 16-Jan-2016
Category:
Upload: cleopatra-morton
View: 225 times
Download: 0 times
Share this document with a friend
Popular Tags:
22
ASP .Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls
Transcript
Page 1: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

ASP .Net, Web Forms and Web Controls

1

Outline

Web ControlsText and Graphics ControlsAdRotator ControlValidation Controls

Page 2: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

Web Controls• Text and Graphics Control• Label, Button, TextBox, Image, RadioButtonList and DropDownList

• AdRotator Control• Randomly selects an image to display and then generates a

hyperlink to the Web page associated with that image• Validation Controls• Determines whether the data in another Web control are in the

proper format• Validates user input• Information in required field?• Zip-code contains exactly 5-digits

• Done on client side (unless client doesn’t support or diables scripting) 2

Page 3: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

3Button control

RadioButtonList control

Hyperlink control

DropDownList control

TextBox control

Image control

Page 4: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

4

Defining style class which can be applied to any element in the document by setting the HTML attribute class

Page 5: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

5

Image control to place image on Web page

Specify file location of image display

Page 6: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

6

NavigateUrl property specifies the resource that is requested

Defines the ListItems that display when the drop-down list is expanded

Button Web control typically maps to an input HTML element with attribute type and value “button”

Page 7: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

7

NOTE: This application contained NO functionality.

You would need to add code to event handlers in WebControls.aspx.cs

This could be left as an exercise.

Page 8: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

AdRotator Control• Address problem of displaying sponsor advertisement• Randomly selects an image to display• Generates hyperlink to a Web page

• Figure rotates the flags of eleven countries.• When the user clicks the image, the browser is redirected to a

Web page containing information about the country the flag represents.

• If user refreshes page, one of 11 flags is chosen at random and displayed.

8

Page 9: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

AdRotator.aspx 9

Set adXmlDataSource control’s DataFile property to AdRotatorInformation.xml

Page 10: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

10No code-behind because AdRotator control does “all the work”

Page 11: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

AdRotator.aspx.cs program output

11

AdRotator image

AlternateText

Page 12: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

AdRotator.aspx.cs Program Output

12

Page 13: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

13

Ad elements each provide information about the advertisement

AlternateText is a tool tip which displays the message when mouse points over image

The higher the Impression value the more often the advertisement will appear

ImageUrl specifies the location of the advertisement imageNavigateUrl indicates URL for the

web page that loads when a userclicks the advertisement

Page 14: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

Validation Controls• Validators• Determine if data in Web controls are proper format

• Example: Demonstrates two type of validation controls.

14

Page 15: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

15

Page 16: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

16

Create a RegularExpressionValidator name emailFormatValidator

Regular expression with which to validate user input

Indicate that that emailExistsValidator verifies inputTextBox’s contents

ErrorMessage’s text to display if error occurs

Confirm that nameTextBox’s content is not empty

Page 17: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

17Visible property set to false initially – will not appear when page loads for the first time

Page 18: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

18

Page 19: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

19

Determine whether the page is being loaded due to postback

retrieve TextBox’s values

Set outputTextBox’s Visible property to true

Page 20: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

Validation.aspx.

cs Program

Output

20

Page 21: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

21

Page 22: ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.

View HTML file

22


Recommended