C# - Webforms Events
Language(s):C#
Category(s):Events
This article shows how to declare Webforms Events

See also: Declaring Events with C#

                Raising Events from a Class

For some reason, Microsoft has chosen not to implement the same interface for declaring Webforms Events as they did with Winforms Events. Anything to make it more confusing I suppose. Well - no matter - it's easy enough when you know how.

Although the Page_Load event appears to come along for free, the other page events must be declared by overriding the base function.

To declare a Webforms double-click your Webform to bring up the code view. Begin the declaration by typing:

protected override

Assuming you have Inteli-sense turned on, you will see the events listed on the Inteli-sense dropdown.


The download project declares the more common page events and writes a message to the debug window when invoked so you can see the order in which they fire.

This article has been viewed 9680 times.
The examples on this page are presented "as is". They may be used in code as long as credit is given to the original author. Contents of this page may not be reproduced or published in any other manner what so ever without written permission from Idioma Software Inc.