Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls."— Presentation transcript:

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

2 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

3 3 Button control RadioButtonList control Hyperlink control DropDownList control TextBox control Image control

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

5 5 Image control to place image on Web page Specify file location of image display

6 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”

7 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.

8 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

9 AdRotator.aspx 9 Set adXmlDataSource control’s DataFile property to AdRotatorInformation.xml

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

11 AdRotator.aspx.cs program output 11 AdRotator image AlternateText

12 AdRotator.aspx.cs Program Output 12

13 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 image NavigateUrl indicates URL for the web page that loads when a user clicks the advertisement

14 Validation Controls Validators Determine if data in Web controls are proper format Example: Demonstrates two type of validation controls. 14

15 15

16 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

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

18 18

19 19 Determine whether the page is being loaded due to postback retrieve TextBox’s valuesSet outputTextBox’s Visible property to true

20 Validation.aspx.cs Program Output 20

21 21

22 View HTML file 22


Download ppt "ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls."

Similar presentations


Ads by Google