Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
PagesSection Class
 AutoEventWireup Property
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
PagesSection.AutoEventWireup Property
Gets or sets a value indicating whether events for ASP.NET pages are automatically connected to event-handling functions.

Namespace: System.Web.Configuration
Assembly: System.Web (in system.web.dll)
Visual Basic (Declaration)
Public Property AutoEventWireup As Boolean
Visual Basic (Usage)
Dim instance As PagesSection
Dim value As Boolean

value = instance.AutoEventWireup

instance.AutoEventWireup = value
C#
public bool AutoEventWireup { get; set; }
C++
public:
property bool AutoEventWireup {
    bool get ();
    void set (bool value);
}
J#
/** @property */
public boolean get_AutoEventWireup ()

/** @property */
public void set_AutoEventWireup (boolean value)
JScript
public function get AutoEventWireup () : boolean

public function set AutoEventWireup (value : boolean)
XAML
Not applicable.

Property Value

true if events for ASP.NET pages are automatically connected to event-handling functions; otherwise, false. The default is true.

When AutoEventWireup is true, ASP.NET does not require events to specify event handlers like Page_Load or Page_Init. This means that the Handles keyword in Visual Basic is not required in the server script in the Web Form page.

By default, when the ASP.NET Web application is created in Visual Studio, the value of the AutoEventWireup attribute is set to false in the .aspx page or .ascx control, and event handlers are not automatically created. Do not set AutoEventWireup to true if performance is a key consideration.

The following code example shows how to use the AutoEventWireup property.

Visual Basic
' Get the current AutoEventWireup property value.
Console.WriteLine( _
    "Current AutoEventWireup value: '{0}'", _
    pagesSection.AutoEventWireup)

' Set the AutoEventWireup property to false.
pagesSection.AutoEventWireup = False
C#
// Get the current AutoEventWireup property value.
Console.WriteLine(
    "Current AutoEventWireup value: '{0}'",
    pagesSection.AutoEventWireup);

// Set the AutoEventWireup property to false.
pagesSection.AutoEventWireup = false;

Windows 98, Windows Server 2000 SP4, 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.

.NET Framework

Supported in: 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
AutoEventWireup set different when using C#      ccengine   |   Edit   |   Show History
By default, when the ASP.NET Web application is created in Visual Studio and the language is set to C#, the value of the AutoEventWireup attribute is set to true in the .aspx page or .ascx control.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker