ASP.NET recreates the ENTIRE control tree for each request. What you write in the .ascx file is translated into the C # code file (you can find them in the ASP.NET Temporary Files folder), which creates the controls, and this code is run on every request. However, in your case this happens:
Request 1: You start out with Button1. Request 2: You start out with Button1. A click event for it is received and processed. In the event handler you add Button2. You end up with Button1 and Button2. Request 3: You start out with Button1. A click event for Button2 is received. Unfortunately there is no Button2, since the control tree got recreated. The event is ignored. You end up with just Button1.
Dynamic controls in ASP.NET web formats are complex. You need to manually track which controls have been added and recreate them at the beginning of each subsequent request. ASP.NET does not remember this for you.
Vilx- source share