setting masterpage event other than OnLoad

D

Daves

I am using 2.0 masterpages. All content pages use some common variables, for
example the DB connection string. Also some pages return links which are
located in a "sublink" area in the masterpage. So the masterpage code would
1) create the public string DBConn and 2) check the public string SubLinks
if it contains any links after the content page was run (if not, hide the
sublink bar). Using Page_OnLoad event the masterpage code is run after the
content page which is fine for 2). For 1) I need it to run BEFORE and I
tried using

void Page_OnPreInit (System.EventArgs e) ...

and even

protected override void OnPreInit(System.EventArgs e) ...

The first line is never run in the first place (not even Page_OnPreInit).
The second line creates error "no suitable method found to override".

So how do I create a masterpage event other than OnLoad???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top