Prop Webcontrol Adrotator Target
## ASP.NET AdRotator Target Property
The `Target` property of the `AdRotator` control is used to get or set the target window or frame where the advertisement's URL should be opened when the ad is clicked.
---
## Definition and Usage
When a user clicks on an advertisement displayed by the `AdRotator` control, they are redirected to the URL specified in the advertisement's configuration file (usually an XML file). The `Target` property determines how and where this destination URL will open (e.g., in a new browser tab, the same frame, or a parent frame).
---
## Syntax
```asp
```
### Property Values
| Value | Description |
| :--- | :--- |
| `_blank` | Opens the destination URL in a new window or tab. |
| `_self` | Opens the destination URL in the same frame or window where the ad was clicked (Default). |
| `_parent` | Opens the destination URL in the parent frameset. |
| `_top` | Opens the destination URL in the full body of the window, removing all frames. |
---
## Code Example
The following example demonstrates how to set the `Target` property of an `AdRotator` control to `_blank`, which ensures that clicking the advertisement opens the advertiser's website in a new browser tab.
### ASPX Page (Default.aspx)
```asp
<%@ Page Language="C#" %>
AdRotator Target Example
```
### Advertisement File (Ads.xml)
The `AdRotator` control reads advertisement details from an XML file. Below is a sample configuration file:
```xml
~/images/banner1.jpg
https://www.youtip.co
Visit YouTip for Developer Tutorials
80
Education
```
---
## Considerations
1. **Global vs. Individual Targets**: The `Target` property on the `` control acts globally for all ads defined in your XML file. If you need different target behaviors for different ads, you will need to handle the redirection programmatically using the `AdCreated` event.
2. **SEO and User Experience**: Setting `Target="_blank"` is highly recommended for advertisements. This ensures that users do not leave your website entirely when they click on an external ad.
3. **Pop-up Blockers**: Modern browsers generally allow `_blank` targets when triggered by a direct user click, but always ensure your site's design accounts for potential pop-up blocker behaviors in strict environments.
YouTip