先做事后做人

博客园 首页 新随笔 联系 订阅 管理

asp:AdRotator 的应用.--主要用来添加广告栏.

The AdRotator Web server control provides a convenient way to display advertisements (ads) on your ASP.NET Web pages.
Ad information can come from a variety of sources, such as the following:

1.An XML file  

(1)How to: Display Ads From an XML File Using the AdRotator Web Server Control

The AdRotator Web server control reads advertisement (ad) information from a data source, which one or more ad records. You can store ad information in an XML file and then bind the AdRotator control to the file.

All attributes of the AdRotator control are optional. The following attributes can be included in the XML files:

ImageUrl   The URL of the image to display.

NavigateUrl   The URL of the page to go to when the AdRotator control is clicked.

AlternateText   The text to display if the image is unavailable.

Keyword   The category of the ad, which can be used to filter for specific ads.

Impressions   A numeric value (a weighting number) that indicates the likelihood of how often the ad is displayed. The total of all impressions values in the XML file cannot exceed 2,048,000,000 - 1.

Height   The height of the ad in pixels. This value overrides the default height setting for the AdRotator control.

Width   The width of the ad in pixels. This value overrides the default width setting for the AdRotator control

example:

The AdRotator control reads advertisement information from a data source, which contains one or more ad records. You can store ad information in a database table with a specific schema, and then use a data source control to read the ad records at run time. If you have an existing table with ad information, you can map the schema of your table to the fields that are required by the AdRotator control.

You can store ad information in any type of database, as long as you have the corresponding data source control for that database.

通过从tool中托拽SqlDatasource控件并进行连接等设置得来.
webconfig
代码
:

       
            providerName="System.Data.SqlClient" />
   

webform端代码.

            SelectCommand="SELECT [ID], [navigateURL], [AlternateText], [ImageURL], [Impressions], [Width], [Height], [Keyword] FROM [ad]">
       
       

<<<..........还需继续看.......>>>

2.Any data source control, such as the SqlDataSource or ObjectDataSource controls  

3.Custom logic

 

 

posted on 2006-03-15 14:26  asdfasdf  阅读(484)  评论(0)    收藏  举报