Dynamically Adding Wired Controls to Web Forms : Page 3
Dynamically creating Web controls and adding them to a Web Form can be a challenging process. A thorough understanding of how the ASP.NET engine instantiates controls as well as the event life cycle of Web Forms is crucial to success.
by Shannon Horn
Jun 20, 2003
Page 3 of 4
Levels of Events
ASP.NET implements three levels of events: validation, cached, and PostBack
Validation events are handled by validation controls on the client's machine at the page level via snippets of JScript embedded in the page. Validation events will either return a true or false value based upon the success of the validation process. If validation fails, the controls will not allow the page to be posted back to the server.
Depending upon the type of control you use, each ASP.NET Web server control may raise events based upon user interaction. For instance, a DropDownListbox control will raise a SelectedIndexChanged event when the user selects a different option from the DropDownListbox. If the control has its AutoPostBack property set to true, raising certain events will cause the page to be posted back to the server. By default, only the Button, LinkButton, and ImageButton controls automatically cause the page to be posted back to the server. When controls raise events that do not cause the page to be posted back to the server, a note that the event was raised is cached in the ViewState of the page. Cached events are handled in the postback process just after the OnLoad() function member has completed executing.