AdRotator.OnPreRender-Methode
Ruft die Informationen über die Werbung zur Wiedergabe durch Suchen nach den Dateidaten oder Aufrufen des Benutzerereignisses ab.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Syntax
'Declaration
Protected Friend Overrides Sub OnPreRender ( _
e As EventArgs _
)
'Usage
Dim e As EventArgs
Me.OnPreRender(e)
protected internal override void OnPreRender (
EventArgs e
)
protected public:
virtual void OnPreRender (
EventArgs^ e
) override
protected void OnPreRender (
EventArgs e
)
protected internal override function OnPreRender (
e : EventArgs
)
Parameter
- e
Ein EventArgs-Objekt, das Ereignisdaten enthält.
Beispiel
Im folgenden Codebeispiel wird das Überschreiben der OnPreRender-Methode veranschaulicht, sodass diese immer einen Rand in einem benutzerdefinierten AdRotator-Steuerelement anzeigt.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page Language="vb" AutoEventWireup="true" %>
<html>
<head>
<title>CustomAdRotator - OnPreRender - VB.NET Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom AdRotator - OnPreRender - VB.NET Example</h3>
<aspSample:CustomADRotatorOnPreRender id="CustomAdRotator1" runat="server" Target="_blank" AdvertisementFile="~/App_Data/Ads.xml" />
</form>
</body>
</html>
...
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
' Run the OnPreRender method on the base class.
MyBase.OnPreRender(e)
' Always display the Ad with a border.
Me.BorderWidth = System.Web.UI.WebControls.Unit.Point(1)
End Sub
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<html>
<head>
<title>CustomAdRotator - OnPreRender - C# Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom AdRotator - OnPreRender - C# Example</h3>
<aspSample:CustomAdRotatorOnPreRender
id="CustomAdRotator1"
runat="server"
Target="_blank"
AdvertisementFile="~/App_Data/Ads.xml" />
</form>
</body>
</html>
...
protected override void OnPreRender(System.EventArgs e)
{
// Run the OnPreRender method on the base class.
base.OnPreRender(e);
// Always display the Ad with a border.
this.BorderWidth = System.Web.UI.WebControls.Unit.Point(1);
}
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page language="VJ#" %>
<html>
<head>
<title>CustomAdRotator - OnPreRender - VJ# Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom AdRotator - OnPreRender - VJ# Example</h3>
<aspSample:CustomAdRotatorOnPreRender
id="CustomAdRotator1"
runat="server"
Target="_blank"
AdvertisementFile="~/App_Data/Ads.xml" />
</form>
</body>
</html>
...
package Samples.AspNet.JSL.Controls;
public class CustomAdRotatorOnPreRender
extends System.Web.UI.WebControls.AdRotator
{
protected void OnPreRender(System.EventArgs e)
{
// Run the OnPreRender method on the base class.
super.OnPreRender(e);
// Always display the Ad with a border.
this.set_BorderWidth(System.Web.UI.WebControls.Unit.Point(1));
} //OnPreRender
} //CustomAdRotatorOnPreRender
Plattformen
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
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
AdRotator-Klasse
AdRotator-Member
System.Web.UI.WebControls-Namespace
AdvertisementFile