AutoWireup
What's the use AutoWireup in Asp.Net?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gohil JayendrasinhPosted Mar 22, 2012, 1:30 AM
hi
Gets or sets a value indicating whether events for ASP.NET pages are automatically connected to event-handling functions or not.
When AutoEventWireup is true, ASP.NET does not require that you explicitly bind event handlers to a page event such as Load.
When AutoEventWireup 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 Load event only if you write code like this.
public partial class AutoEventWireupExample : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
Response.Write("Executing Page_Load");
}
override protected void OnInit(EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);
}
}
if it's helpful to you then please check Accepted Asnwers
Thanks
Satyapriya NayakPosted Mar 22, 2012, 1:27 AM
AutoEventWireup attribute is used to set whether the events needs to be automatically generated or not.
AutoEventWireup is an attribute of the @ Page directive. The AutoEventWireup attribute may have a value of true or false. The value is set to false when you create a new ASP.NET Web Application. This article describes how to set and to change the default values of the AutoEventWireup attribute. This article also describes some of the options of this attribute by using examples of the ASP.NET Web Forms code that is written in Microsoft Visual C# .NET.
You may use the AutoEventWireup attribute to code ASP.NET Web Forms and Web User Controls. When you set the value of the AutoEventWireup attribute to true, the code in ASP.NET Web Forms and in Web User Controls is simple. However, when you use the false value in certain circumstances, you may receive better performance.
You can specify a default value of the AutoEventWireup attribute in several places:
- The Machine.config file
- The Web.config file
- Individual ASP.NET Web Forms (.aspx files)
- Web User Controls (.ascx files)
When you set the value of the AutoEventWireup attribute to true, the ASP.NET runtime does not require events to specify event handlers like the Page_Load event or the Page_Init event. This means that in Visual C# .NET, you do not have to initialize and to create the delegate structures.When you use Microsoft Visual Studio .NET, the value of the AutoEventWireup attribute is set to false and the designer automatically generates event handlers
Please refer the below link
http://support.microsoft.com/kb/324151
http://www.codeproject.com/Articles/9429/AutoEventWireup-attribute-in-Microsoft-ASP-NET-Web
Thanks