NavigateUrlField Property
Collapse the table of content
Expand the table of content

AdRotator.NavigateUrlField Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a custom data field to use in place of the NavigateUrl attribute for an advertisement.

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

public string NavigateUrlField { get; set; }
/** @property */
public String get_NavigateUrlField ()

/** @property */
public void set_NavigateUrlField (String value)

public function get NavigateUrlField () : String

public function set NavigateUrlField (value : String)

Property Value

The name that identifies the field containing the URL for the page to navigate to when the AdRotator control is clicked. The default value is "NavigateUrl."

The NavigateUrlField property is used to select a custom data field used in place of the NavigateUrl attribute for an advertisement. Like NavigateUrl, this custom field is defined in the XML file that contains advertisement information.

The following code example demonstrates using the NavigateUrlField property to specify a custom data field. The NavigateUrlField, ImageUrlField, and AlternateTextField properties are used to dynamically select a custom field to use in place of the NavigateUrl, ImageUrl, and AlternateText attributes. This example uses a device filter to indicate that custom fields should be used for Wireless Application Protocol (WAP)-enabled devices.

<%@ page language="C#" %>

<html>
<body>
  <form id="form1" runat="server">
  <div>
    <p>This example demonstrates using the AdRotator control.</p>
    <p>
      <asp:AdRotator ID="AdRotator1" Runat="server" 
        DataSourceID="Ads" AdType=Popup Winwap:AdType="Banner" 
        Winwap:NavigateUrlField="WMLNavigateUrl"
        Winwap:ImageUrlField="WmlImageUrl"
        Winwap:AlternateTextField="WmlAlternateText"
      />
      <asp:XmlDataSource ID="Ads" 
        Runat="server" 
        DataFile="~/App_Data/AdvertisementList.xml">
      </asp:XmlDataSource>
    </p>
  </div>
  </form>
</body>
</html>

The following is the sample XML data for the previous example.

<Advertisements>
  <Ad>
    <ImageUrl>~/Images/ad1.gif</ImageUrl>
    <NavigateUrl>http://msdn.microsoft.com/vbasic/</NavigateUrl>
    <AlternateText>Visual Basic Developer Site</AlternateText>
    <Width>140</Width>
    <Height>100</Height>
    <!-- The following custom elements will be used by WAP-enabled
      devices. -->
     <WmlImageUrl>~/Images/mobileAd1.jpg</WmlImageUrl>
    <WmlNavigateUrl>http://msdn.microsoft.com/mobile/</WmlNavigateUrl>
    <WmlAlternateText>Windows Mobile Developer Site</WmlAlternateText>
  </Ad>
  <Ad>
    <ImageUrl>~/Images/ad2.gif</ImageUrl>
    <NavigateUrl>http://msdn.microsoft.com</NavigateUrl>
    <AlternateText>MSDN</AlternateText>
    <Width>150</Width>
    <Height>150</Height>
    <!-- The following custom elements will be used by WAP-enabled
      devices. -->
    <WmlImageUrl>~/Images/mobileAd2.jpg</WmlImageUrl>
    <WmlNavigateUrl>http://msdn.microsoft.com/mobility/</WmlNavigateUrl>
    <WmlAlternateText>Windows Mobile Developer Site</WmlAlternateText>
  </Ad>
</Advertisements>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2016 Microsoft