WEBSWAPP Silverlight ASP.NET 3.5 ASP.NET 2.0 ASP.NET 1.0
Cascading Lists
ITemplate
DDL in GridView
G/V MultiSelect
Nested GridViews
RegExp
DataGrid Reorder
Events fire twice
Hyperlink Field
TextBox
UpdateParameters
MultiView
TreeView
C# Demo Correct usage Incorrect Usage

AutoEventWireUp ="True"

Have you ever run into situations where the events on your page fire up twice? It is a common mistake among biginners in ASP.NET to wire up the events in 2 ways: declaratively and programmatically

Here are some scenarios:
  1. Correct behavior: as in the sample to the right. The AutoEventWireUp is set to true and the events are all set declaratively within the HTML markup
  2. Correct behavior: as in the 2nd demo (link below) where the AutoEventWireUp is set to false and the event wireup is done programmatically by overriding the OnInit method
  3. Incorrect behavior: as in 3rd demo (link below) where both the AutoEventWireUp and the overriding of the OnInit method are done to the same page. This causes the evnets to fire up twice.

Correct Event sequence

  1. Page Initialized
  2. Page Loaded
  3. Page_PreRender
Title  
Alfreds Futterkiste
Ana Trujillo Emparedados y helados
Antonio Moreno Taquería
Around the Horn
Berglunds snabbköp
Blauer See Delikatessen
Blondesddsl père et fils
Bólido Comidas preparadas
Bon app'
Bottom-Dollar Markets
12345678910

Source code:

C# Demo source code