Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Advertising Control AdRotator for ASP.NET

Shulou Source: shulou.com Published: 2022-06-03 07:18:31 10月04日 Update

Editor to share with you how to use ASP.NET advertising control AdRotator, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

AdRotator.aspx, create an AdRotator server control in the ASP.NET page and connect the advertisement XML file to this control. Use the following server control tags to complete

The copy code is as follows:

Generate the code for the advertisement

The copy code is as follows:

AdRotator.aspx.cs

Using System

Using System.Collections.Generic

Using System.Linq

Using System.Web

Using System.Web.UI

Using System.Web.UI.WebControls

Public partial class myTest_advertisement: System.Web.UI.Page

{

Protected void Page_Load (object sender, EventArgs e)

{

}

Protected void ad_Created (object sender, AdCreatedEventArgs e)

{

If ((string) e.AdProperties ["Animal"]! = ")

Label1.Text = (string) e.AdProperties ["Aniaml"]

Else

Label1.Text = "N.A."

}

}

Xml document format

The copy code is as follows:

Picture path (local)

Picture connection

A prompt when the mouse is up

Keyword

Priority

Picture path (local)

Picture connection

A prompt when the mouse is up

Keyword

Priority

Picture path (local)

Picture connection

A prompt when the mouse is up

Keyword

Priority

Note xml

AdvertisementFile: XML containing advertising information

BorderColor: set the border color for ads, such as BorderColor= "# 000000" to set the border to black

BorderWidth: boundary width in pixels, such as BorderWidth= "1"

CssClass: font classes from CSS files or inline STYLE elements, such as CssClass= "clsAds"

Height: the height of an advertising image in pixels

KeywordFilter: filter advertising categories, as seen in the example above

Target: the target window of the URL when clicking on the advertisement. Such as Target= "_ new", a new window is created every time the ad image is clicked. "_ top" is the default value

Width: the width of an advertising image in pixels

The KeywordFilter property of the AdRotator control can filter advertisements for a particular category.

The above is all the content of the article "how to use the Advertising Control AdRotator by ASP.NET". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Advertisement code control picture priority key keyword unit image article pixel path border mouse prompt content width file server category Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Docker Shulou Information Microsoft