Thread: Page_Prerender
View Single Post
  #1 (permalink)  
Old May 17th, 2011, 04:07 AM
markhh markhh is offline
Authorized User
Points: 303, Level: 6
Points: 303, Level: 6 Points: 303, Level: 6 Points: 303, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: , , United Kingdom.
Posts: 71
Thanks: 23
Thanked 0 Times in 0 Posts
Default Page_Prerender

Hi all, can anyone tell me the exact sequence the below code runs in. The line
this.PreRender += newEventHandler(Page_Prerender); in particular, what is it, what does it do and at what stage does it run

Correct me if i am wrong but in the BasePage class the Page_Prerender method is called first through the page life cycle... what goes on next in the below code. I am ok with Comparing the contents of the Title bit.

Many thanks
Mark




using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
///<summary>
///
Summary description for BasePage
///</summary>
publicclassBasePage : System.Web.UI.Page
{
//no instance variables
public BasePage()
{
this.PreRender += newEventHandler(Page_Prerender);
// TODO: Add constructor logic here
}
//methods
privatevoid Page_Prerender (Object sender, EventArgs e)
{
if (this.Title == "Untitled page" || String.IsNullOrEmpty (this.Title))
{
thrownewException ("Page does not have a title....");
}
}
}
Reply With Quote