This Code will help us to display ads with equivalent Time interval
For Example: Like dotnetspider's Price & Awards Image show
This code will change the ads, every 3 seconds.
Add this code to your .aspx page:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="XmlDataSource1" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/1.xml">
</asp:XmlDataSource>
<asp:Timer ID="tm" Interval=3000 runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
Create a xml file with following format, also add some images to your project, customize this xml code based on imagename, navigation url., etc.,
Xml File Content: 1.xml :
<Advertisements>
<Ad>
<ImageUrl>\Path\Coffee Bean.bmp</ImageUrl>
<NavigateUrl>http://localhost:1337/</NavigateUrl>
<AlternateText>
The best ASP.Net web site in the world!
</AlternateText>
</Ad>
<Ad>
<ImageUrl>\Path\FeatherTexture.bmp</ImageUrl>
<NavigateUrl>http://localhost:1337/</NavigateUrl>
<AlternateText>
The best ASP.Net web site in the world!
</AlternateText>
</Ad>
<Ad>
<ImageUrl>\Path\Gone Fishing.bmp</ImageUrl>
<NavigateUrl>http://localhost:1337/</NavigateUrl>
<AlternateText>
The best ASP.Net web site in the world!
</AlternateText>
</Ad>
<Ad>
<ImageUrl>\Path\Greenstone.bmp</ImageUrl>
<NavigateUrl>http://localhost:1337/</NavigateUrl>
<AlternateText>
The best ASP.Net web site in the world!
</AlternateText>
</Ad>
<Ad>
<ImageUrl>\Path\Prairie Wind.bmp</ImageUrl>
<NavigateUrl>http://localhost:1337/</NavigateUrl>
<AlternateText>
The best ASP.Net web site in the world!
</AlternateText>
</Ad>
<Ad>
<ImageUrl>\Path\Rhododendron.bmp</ImageUrl>
<NavigateUrl>http://localhost:1337/</NavigateUrl>
<AlternateText>
The best ASP.Net web site in the world!
</AlternateText>
</Ad>
<Ad>
<ImageUrl>\Path\River Sumida.bmp</ImageUrl>
<NavigateUrl>http://localhost:1337/</NavigateUrl>
<AlternateText>
The best ASP.Net web site in the world!
</AlternateText>
</Ad>
No comments:
Post a Comment