Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Execute functions in Base Page of a Page

I have a number of ASPX pages all  deriving from a baseclass called BasePage (which in turn is derived from Page).

Whenever any page is loaded, I need to execute some common methods.  Is there anyway I can do that so that I don't have to call it in the page's page_load every single time? i.e. is there a way I can have a basepage method triggered every time any page has to be loaded?

Sunday, May 8, 2005

You could override the OnLoad method of BasePage and call your methods from there.

Jeff Mastry
Monday, May 9, 2005

Have a look at the code that VS.NET creates and hides in a #region and you'll see that it is obvious.

Joel Spolsky
Monday, May 9, 2005

Put the functions in the constructor of the baseclass

Monday, May 9, 2005

*  Recent Topics

*  Fog Creek Home