Updated - Title changed b/c StyleSheetTheme
and Theme
have nothing to do with it -- see answer for details.
I'm working on a page that has descended, through several years and a few intermediary stages, from another page that successfully uses the AJAX pageLoad()
function to perform some (re-)initialization on full and partial postbacks.
The pageLoad()
on this new page was not firing. A systematic comparison of the two pages ( .aspx
and .js
files) eventually led me to a surprising (to me, anyway) difference that was causing the failure: the old page's @ Page
directive specified a Theme="foo"
, whereas the new page's directive specified a StyleSheetTheme="foo"
. Changing StyleSheetTheme to Theme restores the triggering of the pageLoad()
function.
In this new page I can live with the (non-overridable) Theme settings, so I don't actually have a problem that needs solving in this momemt, but I thought the behavior was not obvious and worth noting, and if someone has insight into the reason(s) StyleSheetTheme might block firing of pageLoad()
I would like to know.
Further investigation with the page referenced in the question as well as other similar pages revealed that the problem had nothing to do with changing between the StyleSheetTheme
and Theme
attributes of the @ Page
directive. I changed the question/title to reflect this.
The actual reason the pageLoad()
function was not being triggered in the particular Javascript file I was working on is that there was already another pageLoad()
function defined in a separate Javascript file being used by the page, and it was the one being executed because it was included later and over-rode/replaced the one I was working on. I found this using a script debugger by locating the pageLoad handling within the ScriptResource.axd file (in function Sys$_Application$raiseLoad()) and following execution into the second, over-riding script file... Palm, meet forehead...
Takeaway points:
pageLoad()
can operate at the page level without resorting to some kind of scheme to daisy-chain multiple scripts; I opted for this approach so each of my script files can add its own (re-)initialization to the chain without clobbering any that are already there StyleSheetTheme
attribute vs the Theme
attribute had nothing to do with my problem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.