CreateChildControls?

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default CreateChildControls?

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

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


    Is there any reason for that?


    George.


    George Ter-Saakov Guest

  2. Similar Questions and Discussions

    1. Validation before or after CreateChildControls
      Hi all, I have a composite control which is basically a wrapper control for child controls and validators. It's a little hacky, but I could...
    2. Use CreatechildControls in asp.net 2.0 page
      Hi I have a page that that loads most of its controls dynamiclly(usercontrols). Is it make sence to add them to the page in CreateChildControls?...
    3. Event Fires after CreateChildControls
      I have created a C# control that creates its objects within CreateChildControls. One of those objects is a button which I have attached to a...
    4. CreateChildControls not being called
      Has anybody ever seen a situation in a custom control where CreateChildControls is not being called? I've set a break point in the method and it is...
    5. What if you don't know your kids in CreateChildControls?
      Hi Mark, You always create your child controls in CreateChildControls. What you have to do is to recreate your childs after the click event...
  3. #2

    Default Re: CreateChildControls?

    The CreateChildControls 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 CreateChildControls is being called as far as
    the behavior of your composite control, but I would definitely consider
    adding EnsureChildControls() 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:ef5vbmQVDHA.2024@TK2MSFTNGP12.phx.gbl...
    > Hi.
    > I have an HTML page were I load controls dynamically.
    >
    > So I overwrote the CreateChildControl but I found some problem.
    > First time when page is called the CreateChildControl is called after
    > Page::Load
    > But when it's a post back the CreateChildControl is called before
    > Page::Load.
    >
    >
    > Is there any reason for that?
    >
    >
    > George.
    >
    >

    William F. Robertson, Jr. Guest

  4. #3

    Default Re: CreateChildControls?

    Thanks.
    Did not know that this method existed.

    George.

    "William F. Robertson, Jr." <wfrobertson@kpmg.com> wrote in message
    news:ejWNLESVDHA.2248@TK2MSFTNGP10.phx.gbl...
    > The CreateChildControls 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 CreateChildControls is being called as far as
    > the behavior of your composite control, but I would definitely consider
    > adding EnsureChildControls() 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:ef5vbmQVDHA.2024@TK2MSFTNGP12.phx.gbl...
    > > Hi.
    > > I have an HTML page were I load controls dynamically.
    > >
    > > So I overwrote the CreateChildControl but I found some problem.
    > > First time when page is called the CreateChildControl is called after
    > > Page::Load
    > > But when it's a post back the CreateChildControl is called before
    > > Page::Load.
    > >
    > >
    > > Is there any reason for that?
    > >
    > >
    > > George.
    > >
    > >
    >
    >

    George Ter-Saakov Guest

  5. #4

    Default Re: CreateChildControls?

    I can type the EnsureChildControls() 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:OzGvxeSVDHA.2236@TK2MSFTNGP10.phx.gbl...
    > Thanks.
    > Did not know that this method existed.
    >
    > George.
    >
    > "William F. Robertson, Jr." <wfrobertson@kpmg.com> wrote in message
    > news:ejWNLESVDHA.2248@TK2MSFTNGP10.phx.gbl...
    > > The CreateChildControls 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 CreateChildControls is being called as far
    as
    > > the behavior of your composite control, but I would definitely consider
    > > adding EnsureChildControls() 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:ef5vbmQVDHA.2024@TK2MSFTNGP12.phx.gbl...
    > > > Hi.
    > > > I have an HTML page were I load controls dynamically.
    > > >
    > > > So I overwrote the CreateChildControl but I found some problem.
    > > > First time when page is called the CreateChildControl is called after
    > > > Page::Load
    > > > But when it's a post back the CreateChildControl is called before
    > > > Page::Load.
    > > >
    > > >
    > > > Is there any reason for that?
    > > >
    > > >
    > > > George.
    > > >
    > > >
    > >
    > >
    >
    >

    William F. Robertson, Jr. Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139