Dynamic controls in composite control

M

Marty

I am writing a composite control that has a public method which allows
the addition of more web controls to the custom controls child control
collection. How can I access the value of those new controls within the
code behind file. See example below:

I perform this in the OnInit method. This is a public method with
additional functionality but the concept is add a new controlt to the
composite control.
mycontrol.Add("ControlName", "ControlValue", new TextBox());

However, I cannot access this new control in the designer like:
ControlName.Text because the control is not part of the pages control
collection.

I am not implementing the INamingContainer Interface due to the need to
name each control as it is added.

This is actually doing much more layout and UI layout but the concept
remains the same.

Any pointers how I can access dynamically added controls to a composite
control?

Thanks
Marty
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top