Master page code executed after child page code

L

Luigi

I'm pretty new in asp.net 2.0 and i'm experiencing this problem: in the
master page code i've included some general initialization code common to
all content pages, but when i start debugging this code is executed after
the content pages code... so i cannot actually take advantage from the
master page variables or code... it seems very silly...
There is a solution for this problem?
Thanks,
Luigi
 
L

Luigi

You can initialize variables like this:

public partial class MyMasterClass : System.Web.UI.MasterPage

{

private System.Collections.ArrayList myArray = new ArrayList();

...
}

Thanks for the reply, but this method is suitable for simple
initializations, not for example managing request variables, etc.

I've finally found the solution: use the Page_init event in the master page,
that is invoked before the same in the content page.

Hope this can be useful for other having the same issue,

Luigi
 
E

Eliyahu Goldin

Luigi,

You can initialize variables like this:

public partial class MyMasterClass : System.Web.UI.MasterPage

{

private System.Collections.ArrayList myArray = new ArrayList();

....
}

Eliyahu
 

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,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top