Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting AutoEventWireup="false" by default

When I add a .aspx page or .ascx control to my website the default value that appears for the AutoEventWireup attribute in the page/control directive is true. Is there any way to change this default value (I mostly set this value to false)? So that I dont have to manually change it each time I add a page. You can call me lazy ;)

Thanks

like image 990
Riain McAtamney Avatar asked Sep 10 '09 14:09

Riain McAtamney


People also ask

What is inherit in ASPX page?

The . aspx page inherits from the code-behind class, and the code-behind class inherits from the Page class. By default, if you are using Visual Studio . NET, a Codebehind attribute is added to the @ Page directive.

Which attribute is an automatic way to bind the events to methods?

The ASP.NET page framework supports an automatic way to associate page events and methods. If the AutoEventWireup attribute of the Page directive is set to true, the page framework calls page events automatically, specifically the Page_Init and Page_Load methods.

What is inline code in asp net?

Inline Code refers to the code that is written inside an ASP.NET Web Page that has an extension of . aspx. It allows the code to be written along with the HTML source code using a <Script> tag.

What does AutoEventWireup do?

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 true , handlers are automatically bound to events at run time based on their name and signature.


1 Answers

Go to the below mentioned locations open the WebForm zip file and edit the page and put the required values

Visual Studio 9

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\CSharp\Web\1033<br/>
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\Web\VisualBasic\1033

Visual Studio 8

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache\Web\CSharp\1033<br/>
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache\Web\VisualBasic\1033

[edit]
You can have further control by removing this directive from here and just enabling or disabling them from web.config

like image 153
Binoj Antony Avatar answered Sep 22 '22 17:09

Binoj Antony