CreateChildControls() when adding controls programmatically

Discussion in 'ASP .Net' started by mark.norgate@gmail.com, Jun 19, 2006.

  1. Guest

    Righto, a problem with programmatically created controls.

    Well, in that kind of area anyway. I'm creating and adding controls to
    my page using TemplateControl.LoadControl quite successfully, but I
    have a button on my page that adds another control (it's a row of a
    table in a timesheet application).

    Trouble is, of course, CreateChildControls() is called before
    AddProject(), which is the method that adds another row to the table. I
    could add this row to the table in AddProject(), but that seems to be
    moving the logic of creating controls out of the CreateChildControls()
    method where it belongs; or am I just being pedantic?

    Have looked at the page lifecycle documentation in the MSDN stuff, but
    there's no real explanation of how to handle this kind of thing.

    Any explanations, or preferably links, would be greatly appreciated.

    Mark
    , Jun 19, 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. Arulraja
    Replies:
    3
    Views:
    1,357
    William F. Robertson, Jr.
    Oct 17, 2003
  2. Paul
    Replies:
    1
    Views:
    377
  3. KJ
    Replies:
    1
    Views:
    208
    Teemu Keiski
    Aug 16, 2003
  4. Hendrik W. Hansen

    Dynamically loading and adding usercontrols after CreateChildControls

    Hendrik W. Hansen, May 28, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    381
  5. Henke
    Replies:
    0
    Views:
    100
    Henke
    Nov 1, 2005
Loading...

Share This Page