Work With Web Controls

The elements of an Advertisement file are as follows:

• The root node of the XML file is the <Advertisements> element, which contains one too many <Ad> elements. Each of the <Ad> elements contain details on different advertisemts. The child nodes to the <Ad> element are the <ImageURL>, <NavigateURL>, <AlternateText>, <Keywords>, and <Impressions> elements.

• The <ImageURL> element is the path and filename for the graphic to be displayed on the banner.

• The <NavigateURL> element is the URL that the user will be sent to when clicking the advertisement.

• The <AlternateText> element is what will be displayed if the Web browser has graphics turned off or displayed as help text when the user places the mouse pointer over the banner.

• The <Keywords> element describes the category under which the advertisement falls. You can use this element to filter out specific ads for different sections of your Web site.

• The control uses the <Impressions> element as a weighting for how often the advertisement should be displayed relative to the other advertisements.

Hltp://localhostM5PAdRolatoi_aspx - Microsoft Internet Explorei

-|S|x|

File Edit View Favorites Tools Help l^J

1 <r< Back ■» [¿J g] ¡2} | ^¡Personal Bar ^Search [jy Favorites | |

i a si ¡a »

I Address hIlp:/7localhoslMSPAdRotator.aspx

T ; ü j Linkt "

Welcome to mylifetimegoals.com

—'

Get started at www.mylifetimegoals.

M

d

â

Ipql Local intranet |

Q Save the file and request from the Web server.

Note: See pages 20 to 25 for instructions on saving a file to the Web server and then requesting the file using the IIS Admin.

http://IocaIhost/ASPAdRotatoi.aspx - Miciosoft Internet Explorer

File Edit View Favorites Tools Help

| <r< Back - - [?] ffl | g Personal Bar ^Search Favorites | ^

jsiäB »

ddress http:/7localhost^ASPAdRolator.aspx

-J Links"

Welcome to mylifetimegoals.com

Set your sites on your goals... ^

a

IpH Local intranet |

■ An advertisement appears. □ Press F5 to refresh the

Web page.

■ Another advertisement may appear.

VALIDATE REQUIRED FIELDS

You can use the RequiredFieldValidator control on your ASP.NET Web pages to specify which controls on your page require input. This is a convenient way to enable very basic validation on your pages. The RequiredFieldValidator checks to make sure that the user has changed a control's value from the initial value. You can use the control with most form controls, like the textbox and the dropdown list box.

To set this up, you have to create a

RequiredFieldValidator control for each of the fields that you want to require input. You must then declare the control at the location you want the error message to be displayed, and specify which control to validate by setting the controltovalidate attribute equal to the id of the control to validate. Finally, you specify the validation message for the user by setting the text attribute.

For example, you can create a simple form that has the user input their login name. Because you always want the user to input something for the field, you can use the RequiredFieldValidator control to ensure that something was entered into the field.

VALIDATE REQUIRED FIELDS

VALIDATE REQUIRED FIELDS

D Open the

GenericTemplate.aspx template from the Code Templates directory.

0 Add a message to the user.

Add a server form to the Page.

-0 Add another message to the user.

-0 Add a TextBox control to the form.

RequiredFieldValidator control to the page and specify a name for the control by adding the ID attribute.

D Open the

GenericTemplate.aspx template from the Code Templates directory.

0 Add a message to the user.

Add a server form to the Page.

-0 Add another message to the user.

-0 Add a TextBox control to the form.

RequiredFieldValidator control to the page and specify a name for the control by adding the ID attribute.

Was this article helpful?

0 -1

Post a comment