I am trying to apply a set of custom controls to a master page via code-behind during Page_Load, initializing the class and using Page.Header.Controls.Add()
. I have another child master page between the parent and the content and this child master references directly in its own code a javascript file which calls a jQuery function (.ready
) which is added in the parent master. This function gives a runtime error of "Object expected".
The problem disappears if I explicitly add the custom controls in the code of the parent master, so I thought to look up the precedences in the loading process (MSDN), but moving the declaration of the parent controls in the Page_Init doesn't work either, and in the Page_PreInit makes even my parent master fail in loding one of itw own js's!
What am I doing wrong? Thank you