using System; using System.Web.UI; using System.Web.UI.WebControls; namespace Example { /// /// This class acts as a controller for the default.aspx page. /// It handles Page events and maps events from /// the classes it contains to event handlers. /// public class DefaultController : Page { /// /// A label on the form /// protected Label MyLabel; /// /// Override of OnLoad that adds some processing. /// /// protected override void OnLoad(EventArgs e) { try { MyLabel.Text = "Right Now: " + DateTime.Now.ToString(); }finally { base.OnLoad(e); // be sure to call base to fire the event } } } }