0
Reply

Wondering if it is possible to edit the Page_Load function after it has been declared.

Jonathan Hearn

Jonathan Hearn

Aug 29 2008 10:56 PM
2.1k
I have one page class that contains a page_load function that should run on every page like this:

public class iPlannerPage:Page
{

    public Label userGreeting;
   
    public void Page_Load()
    {
        if (Session["User"] != null)
            userGreeting.Text = "Welcome,<br/>&nbsp;"+Session["User"];
    }
}

I want this to work on every page, but some pages need other things in the Page_Load(). I tried doing it like this:

public class iPlannerSignUp:iPlannerPage
{
   
    public void Page_Load()
    {
   
        *code block*
       
    }
}

But this just overwrites the old Page_Load with this new code block. Is there any way to take the old Page_Load function and add stuff to it?