Ad Rotator in ASP.Net:
The AdRotator control randomly chooses banner graphics from a list, which is defined in an external XML schedule file. This external XML schedule file is known as the advertisement file.
The AdRotator control permits you to specify the advertisement file and the kind of window that the link could follow in AdvertisementFile and Target property respectively.
The basic syntax of including an AdRotator is as follows:
<asp:AdRotator runat = "server"
AdvertisementFile = "adfile.xml"
Target = "_blank" />
|
Before going into explanation of the AdRotator control and its properties, let us take into the construction of the advertisement file.
The Advertisement File:
The advertisement file is an XML file, which has the information about the advertisements to be shown.
Extensible Markup Language (XML) is a W3C standard for text markup. It is a text-based markup language that actives you to store data in a structured format by needing meaningful tags. The term 'extensible' involves that you may extend you ability to define a document by defining meaningful tags for your application.
XML is not a language in itself, like HTML but, a part of rules for making new markup languages. It is a meta-markup language. It gives developers to prepare custom tag sets for special uses. It structures, saves and transport information.
Subsequent is an example of XML file:
<BOOK>
<NAME> Learn XML </NAME>
<AUTHOR> Samuel Peterson </AUTHOR>
<PUBLISHER> NSS Publications </PUBLISHER>
<PRICE> $30.00</PRICE>
</BOOK>
|
Like all XML files, the advertisement file requirement to be a structured text file with well-described tags delineating the data. There are the giving standard XML components that are generally used in the advertisement file:
Element
|
Description
|
Advertisements
|
Encloses the advertisement file
|
Ad
|
Delineates separate ad
|
ImageUrl
|
The image that will be shown
|
NavigateUrl
|
The link that will be given when the user clicks the ad
|
AlternateText
|
The text that will be shown instead of the picture if it cannot be shown
|
Keyword
|
Keyword identifying a set of advertisements. This is need for filtering
|
Impressions
|
The number showing how often an advertisement will appear
|
Height
|
Height of the image to be shown
|
Width
|
Width of the image to be shown
|
Apart from these tags, customs tags with custom attributes should also be added. The subsequent code illustrates an advertisement file ads.xml:
<Advertisements>
<Ad>
<ImageUrl>rose1.jpg</ImageUrl>
<NavigateUrl>https://www.1800flowers.com</NavigateUrl>
<AlternateText>
Order flowers, roses, gifts and more
</AlternateText>
<Impressions>20</Impressions>
<Keyword>flowers</Keyword>
</Ad>
<Ad>
<ImageUrl>rose2.jpg</ImageUrl>
<NavigateUrl>https://www.babybouquets.com.au</NavigateUrl>
<AlternateText>Order roses and flowers</AlternateText>
<Impressions>20</Impressions>
<Keyword>gifts</Keyword>
</Ad>
<Ad>
<ImageUrl>rose3.jpg</ImageUrl>
<NavigateUrl>https://www.flowers2moscow.com</NavigateUrl>
<AlternateText>Send flowers to Russia</AlternateText>
<Impressions>20</Impressions>
<Keyword>russia</Keyword>
</Ad>
<Ad>
<ImageUrl>rose4.jpg</ImageUrl>
<NavigateUrl>https://www.edibleblooms.com</NavigateUrl>
<AlternateText>Edible Blooms</AlternateText>
<Impressions>20</Impressions>
<Keyword>gifts</Keyword>
</Ad>
</Advertisements>
|
Properties and events of the AdRotator Class:
The AdRotator class is defined from the WebControl class and adds its properties. Apart from those the AdRotator class has the given properties:
Properties
|
Description
|
AdvertisementFile
|
The path to the advertisement file.
|
AlternateTextFeild
|
The component name of the field where change text is given; default value is AlternateText.
|
DataMember
|
The name of the related list of data to be bound when advertisement file is not used.
|
DataSource
|
Control from where it could retrieve data.
|
DataSourceID
|
Id of the control from where it could show data.
|
Font
|
Defines the font properties related with the advertisement banner control.
|
ImageUrlField
|
The element name of the field where the URL for the image is given; default value is ImageUrl.
|
KeywordFilter
|
For showing the keyword based ads only.
|
NavigateUrlField
|
The component name of the field where the URL to navigate to is given; default value is NavigateUrl.
|
Target
|
The browser window or frame that shows the content of the page linked.
|
UniqueID
|
Obtains the unique, hierarchically practiced identifier for the AdRotator control.
|
Subsequent are the important events of the AdRotator Class:
Events
|
Description
|
AdCreated
|
It is increased once per round trip to the server after creation of the control, but before the page is rendered
|
DataBinding
|
Happens when the server control binds to a data source.
|
DataBound
|
Happens after the server control binds to a data source.
|
Disposed
|
Happens when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested
|
Init
|
Happens when the server control is initialized, which is the first step in its lifecycle.
|
Load
|
Happens when the server control is loaded into the Page object.
|
PreRender
|
Happens after the Control object is loaded but prior to rendering.
|
Unload
|
Happens when the server control is unloaded from memory.
|
Working with the AdRotator Control
Prepare a new web page and place an AdRotator control on it.
<form id="form1" runat="server">
<div>
<asp:AdRotator ID="AdRotator1"
runat="server" AdvertisementFile ="~/ads.xml"
onadcreated="AdRotator1_AdCreated" />
</div>
</form>
|
Email based ASP.Net assignment help - homework help at Expertsmind
Are you searching ASP.Net expert for help with Ad Rotator in ASP.Net questions? Ad Rotator in ASP.Net topic is not easier to learn without external help? We at www.expertsmind.com offer finest service of ASP.Net assignment help and ASP.Net homework help. Live tutors are available for 24x7 hours helping students in their Ad Rotator in ASP.Net related problems. Computer science programming assignments help making life easy for students. We provide step by step Ad Rotator in ASP.Net question's answers with 100% plagiarism free content. We prepare quality content and notes for Ad Rotator in ASP.Net topic under ASP.Net theory and study material. These are avail for subscribed users and they can get advantages anytime.
Why Expertsmind for assignment help
- Higher degree holder and experienced experts network
- Punctuality and responsibility of work
- Quality solution with 100% plagiarism free answers
- Time on Delivery
- Privacy of information and details
- Excellence in solving ASP.Net queries in excels and word format.
- Best tutoring assistance 24x7 hours