1. All properties of the AdRotator ad control are optional, and the XML file can contain the attributes shown in the following table (the AD attributes of the XML file).
| Property |
Description |
| ImageUrl |
The URL of the image to display |
| NavigateUrl |
Web page URL to go to when you click the AdRotator control |
| AlternateText |
The real question pump when the image is not available |
| Keyword |
Ad categories that you can use to filter specific ads |
| Impressions |
Numeric value indicating how often the advertisement may appear (weighted value) |
2, DEMO01.APSX:
1 <%@ PageLanguage= "C #"AutoEventWireup= "true"CodeFile= "Demo01.aspx.cs"Inherits= "Demo01" %>2 <!DOCTYPE HTML>3 <HTMLxmlns= "http://www.w3.org/1999/xhtml">4 <Headrunat= "Server">5 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/>6 <title></title>7 </Head>8 <Body>9 <formID= "Form1"runat= "Server">Ten <Divstyle= "Text-align:center"> One <Asp:adrotatorID= "AdRotator1"runat= "Server"AdvertisementFile= "~/demo01xmlfile.xml" /> A </Div> - </form> - </Body> the </HTML>
3, Demo01xmlfile.xml:
1 <?XML version= "1.0" encoding= "Utf-8"?>2 <Advertisements>3 <Ad>4 <IMAGEURL>Images/01.jpg</IMAGEURL>5 <NAVIGATEURL>http://www.cnblogs.com/qikeyishu/</NAVIGATEURL>6 <AlternateText>Link to Geek Art blog</AlternateText>7 <Keyword>Cnblog, blog</Keyword>8 <Impression>80</Impression>9 </Ad>Ten <Ad> One <IMAGEURL>Images/02.jpg</IMAGEURL> A <NAVIGATEURL>http://www.cnblogs.com/qikeyishu/</NAVIGATEURL> - <AlternateText>Link to Geek Art blog</AlternateText> - <Keyword>Cnblog, blog</Keyword> the <Impression>80</Impression> - </Ad> - </Advertisements>
Effect Picture:
source file Download: Demoxml.zip
Create an ad link using the XML language of the ASP.--asp.net