Page is null

Discussion in 'ASP .Net Building Controls' started by Johno, Aug 23, 2006.

  1. Johno

    Johno Guest

    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.
     
    Johno, Aug 23, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kivak Wolf
    Replies:
    2
    Views:
    10,076
    Kivak Wolf
    Jun 28, 2005
  2. vizlab
    Replies:
    3
    Views:
    4,213
    Michael Bar-Sinai
    Oct 17, 2007
  3. Replies:
    16
    Views:
    7,343
    Mike Schilling
    Oct 12, 2005
  4. Replies:
    5
    Views:
    26,694
    Mike Schilling
    Mar 29, 2006
  5. Cirene
    Replies:
    1
    Views:
    816
    Alexey Smirnov
    Jun 9, 2008
Loading...

Share This Page