View Single Post
  #5 (permalink)  
Old August 20th, 2010, 01:09 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

FYI, AutoEventWireup only works for a number of predefined Page events; not for your own controls. For a list of events it applies to, take a look here: http://odetocode.com/blogs/scott/arc...entwireup.aspx

You can't create useful controls in Page_Load as it's too late for the control to participate in the post back architecture and thus the Click event will never be handled.

Instead, you need to do this in Page_Init. Take a look at the following links for more ideas and examples:

http://geekswithblogs.net/shahed/arc...26/123391.aspx
http://www.google.com/#hl=en&source=...rols+Page_Init

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!