Gets or sets a value indicating whether events for ASP.NET pages are automatically connected to event-handling functions.
Assembly: System.Web (in System.Web.dll)
When Load.is true, ASP.NET does not require that you explicitly bind event handlers to a page event such as
When Load event only if you write code like that in the following example (notice the Handles statement in Visual Basic and the event handler code in C#):is false, you must explicitly bind the event to a method. For example, if you have a Page_Load method in the code for a page, the method will be called in response to the
Whenis false, you must explicitly bind event handlers to events, as shown in the preceding example. In that case, the method names do not have to follow a pattern.
The default value is true ifis not specified in the @ Page directive. Visual Studio automatically includes the attribute when it creates code-behind files. For ASP.NET pages written in C#, Visual Studio sets the value to true. For Visual Basic, Visual Studio sets the value to false because handlers are bound to events by using the keyword, which is inserted automatically by Visual Studio when it generates an event handler. If you set to true, you can omit (or remove) the keyword.
Do not setto true if performance is a key consideration. When automatic event wireup is enabled, ASP.NET must make between 15 and 30 tries to match events with methods.
Note the following about binding event handlers to events:
If you setto true, make sure that you do not also manually attach page event handlers to events. If you do, handlers might be called more than one time.
Automatic binding is performed only for page events, not for events for controls on the page.
As an alternative to binding events to handlers, you can override the Oneventname methods of the page or of controls.
The following code example shows how to set or read theproperty in code.
The following example shows the two forms of method signatures that are automatically attached to page events whenis true.
The following example shows how to explicitly wire up events whenis false.
Available since 2.0