Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
365
Adding controls dynamically
posted

I am trying to add controls to the Dialog control dynamically.  I add the controls to the ContentPane.TemplateControl.Controls collection.  Whenever I do this, the control ends up on the page hosting the dialog and not in the dialog.

 Is there something I need to do to get it to show up in the dialog correctly?

 -Daniel

Parents
  • 19308
    posted

    The sure fire way to add a control at runtime is to first add a placeholder control at Design-time.  If you add the PlaceHolder control in the Dialog box at design-time, you can simply add your control to the PlaceHolder control's .Controls collection.

    If your child control is still not showing up in the right place, my guess is that you have a CSS issue - ie. your child control is absolutely positioned, which is making it appear outside of the bounds of its container.

    -Tony

Reply Children