CreateChildControls() when adding controls programmatically

M

mark.norgate

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
 

Ask a Question

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top