Adrotator
Adrotator is a server site control introducing Asp.Net. Adrotator display advertisement dynamically. Adrotator is not static, if there are more advertisement, advertisement comes one by one , when a page is postback . Adrotator display image with text, when click on Adrotator . Adrotator redirect URL to the advertisers WebSite . It is a server side control simply in use , it read XML file to display advertisement. The XML has a specific format which can be read by Adrotator.
Here is the most common attribute of the Adrotator.
Adrotator work with particular XML format, the schema of the XML file content all information and URL link related to advertisement.
Below is the explanation of the XML tag
< Ad > Starting Tag of an advetisement.
< ImageUrl > The URL of the image source on advertisement display.
< NavigateUrl > When click on the advertisement , user will be navigate to this URL.
< AlternateText > A text to display on the tooltips , when user take is mouse on the advertisement.
< Keyword > String to filter advertisement category.
< Impressions > How many user like that advertisement.
< Caption > Caption of the advertisement.
Below is a XML file. Pillow is the example of the ad rotator with the help of the XML file.
XML File
xml version="1.0" encoding="utf-8" ?>
Adrotator is a server site control introducing Asp.Net. Adrotator display advertisement dynamically. Adrotator is not static, if there are more advertisement, advertisement comes one by one , when a page is postback . Adrotator display image with text, when click on Adrotator . Adrotator redirect URL to the advertisers WebSite . It is a server side control simply in use , it read XML file to display advertisement. The XML has a specific format which can be read by Adrotator.
Here is the most common attribute of the Adrotator.
- Constructor :
- Adrotator : Create a new instance of adrotator.
- Properties
- BackColor : Get or Set background color of a adrotator.
- BorderColor : Get or Set border color of a adrotator.
- BorderStyle : Get or Set border style of a adrotator.
- BorderWidth : Get or Set border with offer ad adrotator.
- ClientID : Get the ID generated by server in HTML ,to identify the control.
- CssClass : Get or Set CSS class of the adrotator.
- Enabled : Get or Set adrotator enabled /disabled , boolean indicator true or false.
- ForeColor : Get or Set fore color of the adrotator.
- Method
- Databind : Bind data with the data source .
- Findcontrol :Search for a server control with parameter to identify that control.
- Event
- Disposed : Dispose the advertisement and release all the memories.
- Load : Raised event when control is load.
- Prerender : Raised event before control is render.
- AdCreated : Raised event when advetisement is created.
Adrotator work with particular XML format, the schema of the XML file content all information and URL link related to advertisement.
Below is the explanation of the XML tag
< Impressions >
< Caption > Caption of the advertisement.
Below is a XML file. Pillow is the example of the ad rotator with the help of the XML file.
XML File
xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>Demo1.png</ImageUrl>
<NavigateUrl>http://google.com</NavigateUrl>
<AlternateText>Advertisement
of C# Course </AlternateText>
<Impressions>95</Impressions>
</Ad>
<Ad>
<ImageUrl>Demo2.png</ImageUrl>
<NavigateUrl>http://yahoo.com</NavigateUrl>
<AlternateText>Advertisement
of Asp.Net Course</AlternateText>
<Impressions>54</Impressions>
</Ad>
<Ad>
<ImageUrl>Demo3.png</ImageUrl>
<NavigateUrl>http://bing.com</NavigateUrl>
<AlternateText>Advertisement
of Sql Server</AlternateText>
<Impressions>554</Impressions>
</Ad>
</Advertisements>
Default.aspx
<%@
Page
Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default"
EnableViewState="false"
%>
<%@
OutputCache
Duration="60"
VaryByParam="DropDownList1"
%>
<!DOCTYPE
html
PUBLIC
"-//W3C//DTD
XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head
runat="server">
<title></title>
</head>
<body>
<form
id="form1"
runat="server">
<div>
<asp:AdRotator
ID="AdRotator1"
runat="server"
AdvertisementFile="~/XMLFile.xml"
/>
</div>
</form>
</body>
</html>
Default.aspx.cs
using
System;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
public
partial
class
_Default
: System.Web.UI.Page
{
protected
void
Page_Load(object
sender, EventArgs
e)
{
}
}
Output
No comments:
Post a Comment