Last post Apr 27, 2008 10:58 PM by Nai-Dong Jin - MSFT
Apr 24, 2008 07:10 AM|mharris1984|LINK
I have a composite server control that is creating some other controls in its CreateChildControls() function.. Whenever any of these child controls get to their Render() function they loose their reference to Page.
All through their lifecycle OnLoad, OnPreRender, etc.. Page is valid as you would expect but as soon as a child controls gets to the overridden Render() function, Page = null.
This is causing some problems because I want to do Page.ClientScript.GetWebResourceUrl() to output some embedded images during the rendering. Is this by design or is it a bug?
Apr 27, 2008 10:58 PM|Nai-Dong Jin - MSFT|LINK
Since render is not an event; instead, at this stage of processing, you should try to call the Page.ClientScript.GetWebResourceUrl() method before the rendering
phase. Actually you should get all the urls for embedded resource at the beginning of your control class.