NamingContainer null during page lifecycle

Discussion in 'ASP .Net Building Controls' started by TS, Oct 3, 2008.

  1. TS

    TS Guest

    I am declaratively settting value of custom control in aspx page:
    <ctrl:MaskedEditTextBox ID="mskClient_FullPhone"
    PropertyID="Client_FullPhone" runat="server" ReadOnly="true"
    >929-302-2093</ctrl:MaskedEditTextBox>


    This control has a Text property and in side its setter, i am calling ensure
    childControls, which creates my child controls in which one of them tries to
    access NamingContainer but it and many other properties inherited from
    Control are all throwing null exceptions

    When in life cycle is it OK to access this?

    What options do i have when declaratively setting values like this?



    thanks!!!
     
    TS, Oct 3, 2008
    #1
    1. Advertisements

  2. TS

    Teemu Keiski Guest

    Hi,

    basically Load event is when page and controls should've been loaded. If you
    expect postback loading to happen also before, then it would be
    LoadComplete.

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://aspadvice.com/blogs/joteke

    "TS" <> wrote in message
    news:%...
    >I am declaratively settting value of custom control in aspx page:
    > <ctrl:MaskedEditTextBox ID="mskClient_FullPhone"
    > PropertyID="Client_FullPhone" runat="server" ReadOnly="true"
    > >929-302-2093</ctrl:MaskedEditTextBox>

    >
    > This control has a Text property and in side its setter, i am calling
    > ensure childControls, which creates my child controls in which one of them
    > tries to access NamingContainer but it and many other properties inherited
    > from Control are all throwing null exceptions
    >
    > When in life cycle is it OK to access this?
    >
    > What options do i have when declaratively setting values like this?
    >
    >
    >
    > thanks!!!
    >
    >
     
    Teemu Keiski, Oct 5, 2008
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. msmail.microsoft.com

    NamingContainer and UserControl

    msmail.microsoft.com, Oct 10, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    4,523
    Shahar Prish
    Oct 13, 2004
  2. Tumurbaatar S.

    Dynamic columns and NamingContainer

    Tumurbaatar S., Nov 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,722
    Tumurbaatar S.
    Nov 27, 2005
  3. Replies:
    5
    Views:
    31,041
    Mike Schilling
    Mar 29, 2006
  4. Rob Blij
    Replies:
    0
    Views:
    635
    Rob Blij
    May 25, 2006
  5. Rob Blij
    Replies:
    0
    Views:
    1,210
    Rob Blij
    May 25, 2006
  6. Dan
    Replies:
    1
    Views:
    679
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Apr 4, 2007
  7. Tumurbaatar S.

    Dynamic columns and NamingContainer

    Tumurbaatar S., Nov 27, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    393
    Tumurbaatar S.
    Nov 27, 2005
  8. Rob Blij

    NamingContainer issue

    Rob Blij, May 25, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    236
    Rob Blij
    May 25, 2006
Loading...