The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AdCreatedEventArgs.AlternateText Property

Gets or sets the alternate text displayed in the AdRotator control when the advertisement image is unavailable. Browsers that support the ToolTips feature display this text as a ToolTip for the advertisement.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public string AlternateText { get; set; }

Property Value

Type: System.String
The text displayed in place of the advertisement image if the image is unavailable. The default value is String.Empty.

Use the AlternateText property to specify the text to display if the image specified in the ImageUrl property is not available. In browsers that support the ToolTips feature, this text also appears as a ToolTip for the advertisement.

A separate XML file contains the properties for the displayed advertisement. The AdRotator control automatically sets the AlternateText property with the corresponding alternate text entry in the XML file. This property can also be used to programmatically set the alternate text.

The following code example demonstrates how to programmatically set the AlternateText property.

<%@ Page Language="C#" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >
<head runat="server">
    <title>AdCreatedEventArgs AlternateText Example</title>
<script runat="server">

       void AdCreated_Event(Object sender, AdCreatedEventArgs e) 

          e.AlternateText = "New Alternate Text Value";   





   <form id="form1" runat="server">

      <h3>AdCreatedEventArgs AlternateText Example</h3>

      <asp:AdRotator id="AdRotator1" runat="server"
           AdvertisementFile = "Ads.xml"



The following code example demonstrates how to format the XML file that contains the advertisement information. For more information on the XML file, see the AdvertisementFile property of the AdRotator class.

  <AlternateText>Microsoft Main Site</AlternateText>
  <Caption>This is the caption for Ad#1</Caption> 
  <AlternateText>Wingtip Toys</AlternateText>
  <Caption>This is the caption for Ad#2</Caption> 

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft