Asp net what is the meaning of autoeventwireup and inherits

Understanding the Meaning of AutoEventWireup and Inherits in ASP.NET

When working with ASP.NET, you may come across like AutoEventWireup and Inherits. These terms are essential to understand as they play a crucial role in the functioning of your ASP.NET application. In this article, we will delve into the meaning of AutoEventWireup and Inherits and provide examples to illustrate their usage.


AutoEventWireup is a property in ASP.NET that determines whether events are automatically bound to their handlers. By default, AutoEventWireup is set to true, which means that ASP.NET automatically wires up events to their corresponding event handlers on naming conventions.

For example, if you have a with the ID “btnSubmit” and you want to handle its click event, you can create a method “btnSubmit_Click” in your code-behind file. ASP.NET will automatically wire up the click event of the button to the “btnSubmit_Click” method.

However, if you set AutoEventWireup to false, you need to manually wire up the events to their event handlers using the “Handles” keyword in the code-behind file.

protected void btnSubmit_Click( sender, EventArgs e) Handles btnSubmit.Click
    // Event handling logic here


Inherits is another important attribute in ASP.NET that specifies the code-behind class for a web page. It tells ASP.NET which class to with the markup file.

For example, if you have a code-behind file named “MyPage.aspx.cs” with a class named “MyPage”, you need to set the Inherits attribute in the markup file to associate it with the code-behind class.

By setting the Inherits attribute , ASP.NET can establish a connection between the markup file and the code-behind file, allowing you to access controls and handle events in your code-behind class.

It is important to note that the Inherits attribute should include the fully qualified name of the code-behind class, including the namespace.


Understanding the meaning of AutoEventWireup and Inherits is crucial for developing ASP.NET . AutoEventWireup determines whether events are automatically bound to their event handlers, while Inherits associates the markup file with the code-behind class. By utilizing these concepts effectively, you can enhance the and maintainability of your ASP.NET applications.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents