|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Delegado AdCreatedEventHandler
Namespace: System.Web.UI.WebControls
Assembly: System.Web (em System.Web.dll)
Parâmetros
- sender
- Tipo: System.Object
A origem do evento.
- e
- Tipo: System.Web.UI.WebControls.AdCreatedEventArgs
Um AdCreatedEventArgs que contém os dados do evento.
<%@ Page Language="C#" AutoEventWireup="True" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>AdRotator Example</title> </head> <script language="c#" runat="server"> void AdCreated_Event(Object sender, AdCreatedEventArgs e) { Message.Text=e.NavigateUrl; } </script> <body> <form id="form1" runat="server"> <h3>AdRotator Example</h3> <asp:AdRotator id="test1" runat="server" AdvertisementFile = "~/App_Data/Ads.xml" Borderwidth="1" Target="_blank" OnAdCreated="AdCreated_Event"/><br /><br /> <asp:label id="Message" runat="server"/> </form> </body> </html>
<Advertisements>
<Ad>
<ImageUrl>images/image1.jpg</ImageUrl>
<NavigateUrl>http://www.microsoft.com</NavigateUrl>
<AlternateText>Microsoft Main Site</AlternateText>
<LabelText>Microsoft Main</LabelText>
</Ad>
<Ad>
<ImageUrl>images/image2.jpg</ImageUrl>
<NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>
<AlternateText>Wingtip Toys Site</AlternateText>
<LabelText>Wingtip Toys</LabelText>
</Ad>
</Advertisements>
<%@ Page Language="VB" AutoEventWireup="True" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>AdRotator AdCreated Example</title> </head> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) ' Create an EventHandler delegate for the method you want to handle the event ' and then add it to the list of methods called when the event is raised. AddHandler Ad.AdCreated, AddressOf AdCreated_Event End Sub Sub AdCreated_Event(sender As Object, e As AdCreatedEventArgs) ' Override the AlternateText value from the ads.xml file. e.AlternateText = "Visit this site!" End Sub </script> <body> <form id="form1" runat="server"> <h3>AdRotator AdCreated Example</h3> Notice that the AlternateText property of the advertisement <br /> has been programmatically modified from the value in the XML <br /> file. <br /><br /> <asp:AdRotator id="Ad" runat="server" AdvertisementFile = "~/App_Data/Ads.xml" Borderwidth="1" Target="_blank"/> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>AdRotator AdCreated Example</title> </head> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Create an EventHandler delegate for the method you want to handle the event // and then add it to the list of methods called when the event is raised. Ad.AdCreated += new System.Web.UI.WebControls.AdCreatedEventHandler(this.AdCreated_Event); } void AdCreated_Event(Object sender, AdCreatedEventArgs e) { // Override the AlternateText value from the ads.xml file. e.AlternateText = "Visit this site!"; } </script> <body> <form id="form1" runat="server"> <h3>AdRotator AdCreated Example</h3> Notice that the AlternateText property of the advertisement <br /> has been programmatically modified from the value in the XML <br /> file. <br /><br /> <asp:AdRotator id="Ad" runat="server" AdvertisementFile = "~/App_Data/Ads.xml" Borderwidth="1" Target="_blank"/> </form> </body> </html>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Função Server Core sem suporte), Windows Server 2008 R2 (Função Server Core com suporte com o SP1 ou posterior, Itanium sem suporte)
O .NET Framework não oferece suporte a todas as versões de cada plataforma. Para obter uma lista das versões com suporte, consulte .Requisitos de sistema do NET Framework.