|
|||||||||||||||||||||
|
|||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Abstract.NET is the new distributed computing platform developed by Microsoft and ASP.NET is its programming model for web development. Advertisements on Web pages typically take the form of ad banners — .gif files or similar images — that when clicked redirect the user to the advertisers' Web pages. In order to generate ads on your Web page you will need the image files and accompanying URLs. The intent of this article is to get a good experience in developing using the Overview of the SolutionThe
XMLOne method of storing ad banner image locations, URLs for redirection, and associated properties is to put the detailed information in an XML file. By using the XML file format, you can create and maintain a list of advertisements without having to change the other code inside your application when a change is made to an advertisement. The XML file can be created using the Ad Rotator Schedule File template in the XML designer or manually by the developer. Controls used in this applicationprotected System.Web.UI.WebControls.AdRotator AdRotator;
protected System.Web.UI.WebControls.PlaceHolder PlaceHolder1;
Namespaces used in this application:using System.Web.UI.WebControls;
using System.Drawing;
using System.Web.UI.HtmlControls;
Solution with CodeIn the XML file, we can filter the ads by the keywords we declared for each ad. First you add the Adding the // XML CODE THAT AS THE DETAILS ABOUT THE ADS
<Advertisements>
<Ad>
<ImageUrl>D:\Viv_B-Practice\AdRotator_VT\www.asp.net.gif</ImageUrl>
<NavigateUrl>http://www.asp.net</NavigateUrl>
<AlternateText>ASP.NET Logo</AlternateText>
<Keyword>A</Keyword>
<Impressions>Technology</Impressions>
<Caption>This is the caption for Ad#1</Caption>
</Ad>
<Ad>
<ImageUrl>D:\Viv_B-Practice\AdRotator_VT\www.sulekha.com.gif</ImageUrl>
<NavigateUrl>http://www.sulekha.net</NavigateUrl>
<AlternateText>www.Sulekha.net</AlternateText>
<Keyword>S</Keyword>
<Impressions>Web Site</Impressions>
<Caption>This is the caption for Ad#2</Caption>
</Ad>
<Ad>
<ImageUrl>D:\Viv_B-Practice\AdRotator_VT\FlashFile.swf</ImageUrl>
<NavigateUrl>AdRotator.aspx?ad=Widgets
&target=http://msdn.microsoft.com/widgets/</NavigateUrl>
<AlternateText>www.neostream.net</AlternateText>
<Keyword>S</Keyword>
<Impressions>Flash Site</Impressions>
<Caption>This is the caption for Ad#2</Caption>
</Ad>
</Advertisements>
The above shown is the XML code. The above XML template contains the details about each ad that is going to be placed in the web application. You can create an ad list for the The AdRotator Properties
The AdRotator ClassBasically, the actual <asp:AdRotator id="controlName" runat="server"
AdvertisementFile="ads.xml" Target="_self">
</asp:AdRotator>
Here we can see how a placeholder control creates the ad rotator control at runtime dynamically and how it works. The // Create an AdRotator control.
AdRotator rotator = new AdRotator();
// Set the control's properties.
rotator.AdvertisementFile = "AdRotatorFiles.xml";
// Add the control to the Controls collection of a
// PlaceHolder control.
PlaceHolder1.Controls.Add(rotator);
The |
||||||||||||||||||||
|
|||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 2 May 2005 Editor: Smitha Vijayan |
Copyright 2005 by vivekthangaswamy Everything else Copyright © CodeProject, 1999-2008 Web11 | Advertise on the Code Project |