Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 20, 2007 09:15 PM by dotnetorbust
Dec 20, 2007 07:05 PM|LINK
Does anyone know if it's possible to use sys.application.on_init(), or some other feature of the MS AJAX client-side library, to cause the client browser to load a specific CSS file?
I have a user control that needs to load a css file based on a design time setting. The problem is that, since there's a MasterPage involved, I don't seem to be able to update the Page.Header control collection. It works if the user control is on a stand
alone aspx (see code below), but throws the following exception when a MasterPage is introduced:
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
I was hoping that, since the MasterPage has the ScriptManager control in place, there might be a way to let the User Control register the loading of the css file using the client-side AJAX library. Any help would be appreciated!
link2.Href = Page.ResolveUrl(
Dec 20, 2007 07:50 PM|LINK
Add runat="server" to the <head> tag on the master page, and it should work.
Dec 20, 2007 09:15 PM|LINK
Thanks for your reply, E !!
That was it.