This documentation is archived and is not being maintained.

AdRotator.Target Property

Gets or sets the name of the browser window or frame that displays the contents of the Web page linked to when the AdRotator control is clicked.

[Visual Basic]
Public Property Target As String
[C#]
public string Target {get; set;}
[C++]
public: __property String* get_Target();
public: __property void set_Target(String*);
[JScript]
public function get Target() : String;
public function set Target(String);

Property Value

The browser window or frame that displays the contents of the Web page linked to when the AdRotator control is clicked. The default value is String.Empty.

Remarks

Use the Target property to specify the target window or frame that displays the contents of the Web page linked to when the AdRotator control is clicked. Values must begin with a letter in the range of a to z (case insensitive), except for the following special values, which begin with an underscore:

_blank Renders the content in a new, unframed window.
_parent Renders the content in the frameset parent.
_self Renders the content in the frame with focus.
_top Renders the content in the full, unframed window.

Example

[Visual Basic, C#, JScript] The following example demonstrates how to use the Target property. It displays the contents of the Web page linked to when the AdRotator control is clicked in a new, unframed window.

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
 
 <head>
 </head>
 
 <body>
    <form runat="server">
 
       <h3>AdRotator Example</h3>
 
       <asp:AdRotator id="AdRotator1" runat="server"
            Target="_self"
            AdvertisementFile="Ads.xml"/>
 
    </form>
 </body>
 
 </html>

[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
 
 <head>
 </head>
 
 <body>
    <form runat="server">
 
       <h3>AdRotator Example</h3>
 
       <asp:AdRotator id="AdRotator1" runat="server"
            Target="_self"
            AdvertisementFile="Ads.xml"/>
 
    </form>
 </body>
 
 </html>

[JScript] 
<%@ Page Language="JScript" AutoEventWireup="True" %>
<html>
 
 <head>
 </head>
 
 <body>
    <form runat="server">
 
       <h3>AdRotator Example</h3>
 
       <asp:AdRotator id="AdRotator1" runat="server"
            Target="_self"
            AdvertisementFile="Ads.xml"/>
 
    </form>
 </body>
 
 </html>

[Visual Basic, C#, JScript] The following example demonstrates the file format for an XML file that contains advertisement information. For more information on the file format, see the AdvertisementFile member.

<Advertisements>
 
 <Ad>
 <ImageUrl>image1.jpg</ImageUrl>
 <NavigateUrl>http://www.microsoft.com</NavigateUrl>
 <AlternateText>Microsoft Main Site</AlternateText>
 <Impressions>80</Impressions>
 <Keyword>Topic1</Keyword>
 <Caption>This is the caption for Ad#1</Caption> 
 </Ad>
 
 <Ad>
 <ImageUrl>image2.jpg</ImageUrl>
 <NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>
 <AlternateText>Wing Tip Toys</AlternateText>
 <Impressions>80</Impressions>
 <Keyword>Topic2</Keyword>
 <Caption>This is the caption for Ad#2</Caption> 
 </Ad>
 
</Advertisements>

[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

AdRotator Class | AdRotator Members | System.Web.UI.WebControls Namespace | AdvertisementFile

Show: