tag:blogger.com,1999:blog-1150882521993032548.post6642997838259833053..comments2023-08-24T14:19:01.723+01:00Comments on Ale Riolo's blog: AutoEventWireup is evil!Alessandro Riolohttp://www.blogger.com/profile/15588175644785091117noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-1150882521993032548.post-17958260384383878272010-01-03T04:50:35.038+00:002010-01-03T04:50:35.038+00:00This was an excellent article! I hope someone will...This was an excellent article! I hope someone will help me understand something: When the @Page AutoEventWireup value is set to True, is it ONLY the Page event delegates that get auto-created--or does this also happen with controls, such as the aspx:Button control? The reason I ask is that I recently did a ASP.Net 1.1 to 2.0 migration using Microsoft's "wizard". AutoEventWireup was set to True for all of my pages (arrgh!). In addition, the event delegates for the page were removed from my aspx.cs' InitializeComponent() function. But it did not stop there: In my 1.1 app my InitializeComponent() function also had contained event delegate declarations for such things as an OK button:<br /><br />this.cmdOK.Click += new System.Web.UI.ImageClickEventHandler(this.cmdOK_Click);<br /><br />But that too was removed by the "wizard". In my aspx document, the button look like this (it is my own button control):<br /><br />(I had to use {} rather than angle bracets for this post to work...)<br /><br /><br />{dsw:RolloverButton id="cmdOK" runat="server" ButtonStyle="SymmetricalTemplate" XmlClass="FormButton"<br /><br />XmlClassFileName="rolloverbutton.xml" text="OK" AlternateText="OK" onclick="cmdOK_Click"}{/dsw:RolloverButton}<br /><br />Notice that it has an onlick assignment of "cmdOK_Click". My 1.1 app did not have that but my 1.1 app also used AutoEventWireup = False for that page. <br /><br />It seems to me that when AutoEventWireup = True in an @Page directive, not only will Page_* event handlers be called automatically, but it seems that the controls get their events wired-up automatically in such as way as to make the manual delegate declaration in InitializeComponent unnecessary. <br /><br />Am I right here, or is there another reason that the onclick attribute for my button control is "automagically" getting a delegate and successfully calling the cmdOK_Click event handler with no explicit delegate declaration in InitializeComponent()?<br /><br />Thank you,<br />JimJimnoreply@blogger.comtag:blogger.com,1999:blog-1150882521993032548.post-2379243235045895612009-11-08T18:35:19.604+00:002009-11-08T18:35:19.604+00:00great analisys about AutoEventWireUp!
thanksgreat analisys about AutoEventWireUp!<br />thanksevilripperhttp://www.evilripper.netnoreply@blogger.comtag:blogger.com,1999:blog-1150882521993032548.post-23012130451478062592009-01-27T11:56:00.000+00:002009-01-27T11:56:00.000+00:00Very good article. Thanks for posting this useful ...Very good article. Thanks for posting this useful information.it is one of the best article i found on AutoEventWireUp. It really helped me to understand the much confused AutoEventWireUp propertyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1150882521993032548.post-19597317256793113332008-06-12T14:36:00.000+01:002008-06-12T14:36:00.000+01:00Nice investigation buddy :-)We had similar problem...Nice investigation buddy :-)<BR/>We had similar problems with our application under heavy load. Once i captured a hang dump when the CPU was running hot and I could see many threads making a call to HookupAutomaticHandlers.Back of my mind i knew that AutoEventWireup could be a culprit here.My doubts were confirmed when i googled up your blog. <BR/>It's unfortunate that VS 2005 enables AutoEventWireup by default.Anonymousnoreply@blogger.com