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

No members online now.

Forum statistics

Threads
473,745
Messages
2,569,487
Members
44,909
Latest member
DestinyKetoScam

Latest Threads

Top