Page is null

J

Johno

I'm converting a custom webcontrol from ASP.NET 1.1 to 2.0 to take advantage
of 2.0's new features, particularly using the WebResource handler to embed
Javascript includes and GIFs within the assembly instead of placing such
files in an aspnet_client sub-directory. The only problem I've found with the
conversion is that when I call :
this.Page.ClientScript.GetWebResourceUrl()
as a result of calling EnsureChildControls() in property get and set
methods, this.Page is null; I guess this is because the control hasn't been
inserted in the Page's controls collection.
Is there some way to force the control to add itself to the page so that I
can avoid this error?

I guess I could move the calls to this.Page.ClientScript.GetWebResourceUrl()
to the control's prerender method but I'd rather void this if possible.

Are there any good web resources on the differences/enhancements for
creating ASP.NET 2.0 custom web controls? I've looked at Nikhil Kothari's
blog. Any others worth checking out?

Any info/advice gratefully appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top