Click here to Skip to main content
16,008,490 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the use of AutoEventwireup in page/master directive?
Posted

You can see lot of explanation for this type of questions if you search in Google. If you set this property to true then page events will automatically hooked up with corresponding event handlers. Otherwise you should explicitly attach the event.

autoeventwireup[^]
 
Share this answer
 
the ASP.NET page framework also supports an automatic way to associate page events and methods. If the AutoEventWireup attribute of the Page directive is set to true (or if it is missing, since by default it is true), the page framework calls page events automatically, specifically the Page_Init and Page_Load methods. In that case, no explicit Handles clause or delegate is needed.
The disadvantage of the AutoEventWireup attribute is that it requires that the page event handlers have specific, predictable names. This limits your flexibility in how you name your event handlers. Therefore, in Visual Studio, the AutoEventWireup attribute is set to false by default and the designer generates explicit code to bind page events to methods.
If you do set AutoEventWireup to true, Visual Studio will generate code to bind the events and the page framework will automatically call events based on their names. This can result in the same event code being called twice when the page runs. As a consequence, you should always leave AutoEventWireup set to false when working in Visual Studio.

Thanks
Hiren Solanki
 
Share this answer
 
Comments
Ankur\m/ 27-Aug-10 8:05am    
Reason for my vote of 1
Reasons already provided in you previous posts. Also copied this from http://msdn.microsoft.com/en-us/library/59t350k3%28VS.71%29.aspx
Hiren solanki 27-Aug-10 8:08am    
sorry, By mistake

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900