You can use the AutoEventWireup value true or false. By default its value is set to false. We can specify the default value of the AutoEventWireup attribute in the following locations:
- The Machine.config file.
- The Web.config file.
- Individual Web Forms (.aspx files).
- Web User Controls (.ascx files)
In .Config file this attribute can be declared as:
<configuration>
<system.web>
<pages autoEventWireup="false"
/>
</system.web>
</configuration>
For Individual .aspx files:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" AutoEventWireup="false" Inherits="_Default" %>
I hope the above information will be helpful. If you have more concerns, please let me know.