AdRotator.ImageKey Property
Assembly: System.Web.Mobile (in system.web.mobile.dll)
[BindableAttribute(true)] public: property String^ ImageKey { String^ get (); void set (String^ value); }
/** @property */ public String get_ImageKey () /** @property */ public void set_ImageKey (String value)
public function get ImageKey () : String public function set ImageKey (value : String)
Not applicable.
Property Value
The element name from which the image URL is retrieved for an advertisement.You can create elements in the source XML file for a variety of purposes. For example, you may want to use the same XML file for both mobile pages and Web pages, but want a different image file for each one. Use the ImageKey property to specify which element in your XML file you want to use for the image URL.
You can also use separate <Choice> Element (.NET Framework Developer's Guide ) elements to override this setting to show alternate images for the advertisement.
The following code example demonstrates how to use the ImageKey property to select a specific item from a record in the XML file. This .aspx file specifies that the value for the image URL can be obtained from the <MobileImageSrc> element of the XML file, and uses a <Choice> Element (.NET Framework Developer's Guide ) element to select a different image URL if the user's browser requires WML markup.
The .aspx file:
The sample ads.xml file (which must be located in the App_Data folder):
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<WebImgSrc>imgA1.gif</WebImgSrc>
<MobileImgSrc>imgA2.gif</MobileImgSrc>
<WmlImgSrc>imgA3.gif</WmlImgSrc>
<TargetUrl>http://msdn.microsoft.com/</TargetUrl>
<WmlTargetUrl>http://OurServer/MS-MSDN.wml</WmlTargetUrl>
<AlternateText>MSDN</AlternateText>
<Keyword>Developer</Keyword>
<Impressions>80</Impressions>
</Ad>
<Ad>
<WebImgSrc>imgB1.gif</WebImgSrc>
<MobileImgSrc>imgB2.gif</MobileImgSrc>
<WmlImgSrc>imgB3.gif</WmlImgSrc>
<TargetUrl>http://www.microsoft.com/</TargetUrl>
<WmlTargetUrl>http://OurServer/MS-Home.wml</WmlTargetUrl>
<AlternateText>Microsoft</AlternateText>
<Keyword>Customer</Keyword>
<Impressions>90</Impressions>
</Ad>
<Ad>
<WebImgSrc>imgC1.gif</WebImgSrc>
<MobileImgSrc>imgC2.gif</MobileImgSrc>
<WmlImgSrc>imgC3.gif</WmlImgSrc>
<TargetUrl>http://www.microsoft.com/net/</TargetUrl>
<WmlTargetUrl>http://OurServer/MS-Net.wml</WmlTargetUrl>
<AlternateText>.NET</AlternateText>
<Keyword>Developer</Keyword>
<Impressions>80</Impressions>
</Ad>
</Advertisements>
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.