This control is simple and uses an XML file as the data source.
Source code of the aspx File
1 <% @ Page Language = " C # " Autoeventwireup = " True " Codefile = " Adrotatorcontrol. aspx. CS " Inherits = " Adrotatorcontrol " %>
2
3 <! Doctype HTML public " -// W3C // dtd xhtml 1.0 transitional // en " " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
4
5 < HTML xmlns = " Http://www.w3.org/1999/xhtml " >
6 < Head runat = " Server " >
7 < Title > Application Example of AD control </ Title >
8 </ Head >
9 < Body >
10 < Form ID = " Form1 " Runat = " Server " >
11 < Div >
12 < ASP: Panel ID = " Adpanel " Runat = " Server " Height = " 50px " Width = " 125px " >
13 < ASP: adrotator ID = " Myadrotator " Runat = " Server " Advertisementfile = " ~ /App_data/Ad. xml "
14 Height = " 60px " Width = " 60px " />
15 </ ASP: Panel >
16
17 </ Div >
18 </ Form >
19 </ Body >
20 </ Html >
XML file
1 <? XML version = "1.0" ?>
2 < Advertisements >
3 < Ad >
4 < Imageurl > ~ /Sohu.gif </ Imageurl >
5 < Navigateurl > Http://www.sohu.com </ Navigateurl >
6 < Alternatetext > Sohu website </ Alternatetext >
7 < Keywordfilter > Software </ Keywordfilter >
8 < Impressions > 80 </ Impressions >
9 </ Ad >
10 < Ad >
11 < Imageurl > ~ /Tom.gif </ Imageurl >
12 < Navigateurl > Http://www.tom.com </ Navigateurl >
13 < Alternatetext > Tom website </ Alternatetext >
14 < Keywordfilter > Software </ Keywordfilter >
15 < Impressions > 80 </ Impressions >
16 </ Ad >
17 </ Advertisements >