Setting AutoEventWireup=“false” by default

2019-06-21 16:48发布

问题:

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

回答1:

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