Dynamic controls in composite control

Discussion in 'ASP .Net Web Controls' started by Marty, Oct 4, 2005.

  1. Marty

    Marty Guest

    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
     
    Marty, Oct 4, 2005
    #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. sleigh
    Replies:
    1
    Views:
    2,740
    sleigh
    Feb 12, 2004
  2. Harry
    Replies:
    2
    Views:
    674
    Harry
    Apr 16, 2004
  3. Matt Sollars

    Composite control with dynamic controls depending on a property value

    Matt Sollars, Jul 27, 2004, in forum: ASP .Net Building Controls
    Replies:
    7
    Views:
    190
    Matt Sollars
    Jul 30, 2004
  4. Chad
    Replies:
    0
    Views:
    254
  5. Mike

    Composite vs non composite Controls

    Mike, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    293
    Sundararajan
    Mar 11, 2005
Loading...

Share This Page