CreateChildControls?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George Ter-Saakov

    #1

    CreateChildControls?

    Hi.
    I have an HTML page were I load controls dynamically.

    So I overwrote the CreateChildCont rol but I found some problem.
    First time when page is called the CreateChildCont rol is called after
    Page::Load
    But when it's a post back the CreateChildCont rol is called before
    Page::Load.


    Is there any reason for that?


    George.


  • William F. Robertson, Jr.

    #2
    Re: CreateChildCont rols?

    The CreateChildCont rols is called in a composite control before the child
    controls are needed. The child controls more than likely need to processes
    some postback data ( or events ) and thus, they are required to be around
    before the page load.

    It shouldn't matter when the CreateChildCont rols is being called as far as
    the behavior of your composite control, but I would definitely consider
    adding EnsureChildCont rols() before every method or property that access the
    child controls and don't concern your self of the "first" time it is called.

    HTH,

    bill



    "George Ter-Saakov" <we@hotmail.com > wrote in message
    news:ef5vbmQVDH A.2024@TK2MSFTN GP12.phx.gbl...[color=blue]
    > Hi.
    > I have an HTML page were I load controls dynamically.
    >
    > So I overwrote the CreateChildCont rol but I found some problem.
    > First time when page is called the CreateChildCont rol is called after
    > Page::Load
    > But when it's a post back the CreateChildCont rol is called before
    > Page::Load.
    >
    >
    > Is there any reason for that?
    >
    >
    > George.
    >
    >[/color]


    Comment

    • George Ter-Saakov

      #3
      Re: CreateChildCont rols?

      Thanks.
      Did not know that this method existed.

      George.

      "William F. Robertson, Jr." <wfrobertson@kp mg.com> wrote in message
      news:ejWNLESVDH A.2248@TK2MSFTN GP10.phx.gbl...[color=blue]
      > The CreateChildCont rols is called in a composite control before the child
      > controls are needed. The child controls more than likely need to[/color]
      processes[color=blue]
      > some postback data ( or events ) and thus, they are required to be around
      > before the page load.
      >
      > It shouldn't matter when the CreateChildCont rols is being called as far as
      > the behavior of your composite control, but I would definitely consider
      > adding EnsureChildCont rols() before every method or property that access[/color]
      the[color=blue]
      > child controls and don't concern your self of the "first" time it is[/color]
      called.[color=blue]
      >
      > HTH,
      >
      > bill
      >
      >
      >
      > "George Ter-Saakov" <we@hotmail.com > wrote in message
      > news:ef5vbmQVDH A.2024@TK2MSFTN GP12.phx.gbl...[color=green]
      > > Hi.
      > > I have an HTML page were I load controls dynamically.
      > >
      > > So I overwrote the CreateChildCont rol but I found some problem.
      > > First time when page is called the CreateChildCont rol is called after
      > > Page::Load
      > > But when it's a post back the CreateChildCont rol is called before
      > > Page::Load.
      > >
      > >
      > > Is there any reason for that?
      > >
      > >
      > > George.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • William F. Robertson, Jr.

        #4
        Re: CreateChildCont rols?

        I can type the EnsureChildCont rols() really fast since I use it about 4000
        times in each of my controls. Typically on the properties for the composite
        controls.

        happy coding.

        bill

        "George Ter-Saakov" <we@hotmail.com > wrote in message
        news:OzGvxeSVDH A.2236@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Thanks.
        > Did not know that this method existed.
        >
        > George.
        >
        > "William F. Robertson, Jr." <wfrobertson@kp mg.com> wrote in message
        > news:ejWNLESVDH A.2248@TK2MSFTN GP10.phx.gbl...[color=green]
        > > The CreateChildCont rols is called in a composite control before the[/color][/color]
        child[color=blue][color=green]
        > > controls are needed. The child controls more than likely need to[/color]
        > processes[color=green]
        > > some postback data ( or events ) and thus, they are required to be[/color][/color]
        around[color=blue][color=green]
        > > before the page load.
        > >
        > > It shouldn't matter when the CreateChildCont rols is being called as far[/color][/color]
        as[color=blue][color=green]
        > > the behavior of your composite control, but I would definitely consider
        > > adding EnsureChildCont rols() before every method or property that access[/color]
        > the[color=green]
        > > child controls and don't concern your self of the "first" time it is[/color]
        > called.[color=green]
        > >
        > > HTH,
        > >
        > > bill
        > >
        > >
        > >
        > > "George Ter-Saakov" <we@hotmail.com > wrote in message
        > > news:ef5vbmQVDH A.2024@TK2MSFTN GP12.phx.gbl...[color=darkred]
        > > > Hi.
        > > > I have an HTML page were I load controls dynamically.
        > > >
        > > > So I overwrote the CreateChildCont rol but I found some problem.
        > > > First time when page is called the CreateChildCont rol is called after
        > > > Page::Load
        > > > But when it's a post back the CreateChildCont rol is called before
        > > > Page::Load.
        > > >
        > > >
        > > > Is there any reason for that?
        > > >
        > > >
        > > > George.
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...