Forum Moderators: open

Message Too Old, No Replies

Accessing changed global var. value from content to master pages

Accessing changed global var. value from content to master pages

         

paul_owen

11:05 pm on Sep 23, 2009 (gmt 0)

10+ Year Member



I have a master page and content page, each with their own codeBehind.

I am trying to reference a global variable of the master from the content, no problem, I can access is ok.

However, this global variable is changed in the master page's Page_Load phase, but the new value is not picked up in the content page. The value is read in the content pages' codeBehind Page_Load method.

What am I doing wrong?

Thanks,
Paul.

Ocean10000

12:24 am on Sep 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Content Page Page_Load is triggered before the Master Page Load Event.

Events in ASP.NET Master and Content Pages [msdn.microsoft.com]

So you are not doing anything wrong per say. Just the load order isn't what one would expect is all.

paul_owen

4:32 am on Sep 24, 2009 (gmt 0)

10+ Year Member



Ha ha! I knew that, but forget!

I moved the variable change to the master page's Page_Init and it works fine.

Thanks a lot,
Paul.