Step 1 :- We need to .XML file to bind with AdRotator Control.
Step 2 :- Follow step to add XML File in your project or Copy/past below
content on it.
Go to your Visual Studio Solution Explorer - Right Click to your
project Name - Click on Add - Click on New Items... - Left Pane Expand the
Visual C# Menu - Select the data menu - select the XML FILE from Middle
pane
Step 3 :- Give Name AdRotator.xml or What you want.
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<!--
The URL for the ad image -->
<ImageUrl>~/Images/Baby.jpg</ImageUrl>
<!--
The URL the ad redirects the user to -->
<NavigateUrl>http://www.abc.com</NavigateUrl>
<!--
The alternate text for the image -->
<AlternateText> Support
for developers </AlternateText>
<!--
The relative number of times this ad should appear -->
<!--
compared to the others -->
<Impressions>80</Impressions>
<!--
The topic of this ad (used for filtering) -->
<Keyword>ProductInfo</Keyword>
</Ad>
<Ad>
<ImageUrl>~/Images/Rose.jpg</ImageUrl>
<NavigateUrl>http://www.abc.com</NavigateUrl>
<AlternateText>S
Support for developers </AlternateText>
<Impressions>40</Impressions>
<Keyword>Support</Keyword>
</Ad>
<Ad>
<ImageUrl>~/Images/Scane.jpg</ImageUrl>
<NavigateUrl>http://www.abc.com</NavigateUrl>
<AlternateText>Support
for developers</AlternateText>
<Impressions>40</Impressions>
<Keyword>Support</Keyword>
</Ad>
</Advertisements>
Step 4 :- Add AdRotator Control in your Default.aspx file.
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/XML/AdRotator.xml"
Height="30%" Width="30%" />
Step 5 :-
AdvertisementFile="~/XML/AdRotator.xml"
We have to set the AdvertisementFile attribute of AdRotator Control. Where we have
provide the XML file path.
In AdvertisementFile attribute I am
binding the xml file path.
Here AdRotator.xml file Store in the XML folder.
Note :-
When our page post back the Image got change in which we mentioned
images in AdRotator.xml file.
No comments:
Post a Comment