To remove the old control:
parentControl.Controls.Remove(o_OldControl) ' remove ONE control
from parent
OR
ParentControl.Controls.Clear ' Remove ALL
controls from parent
Then, to add the new control:
parentControl.Controls.add(o_NewControl) ' add to parent as the
Next sibling
OR
parentControl.Controls.AddAt(iIndexPosition, o_NewControl) ' add to
parent at a specific location
You could also not put ANY control in your HTML template, and just add the
correct control within the code-behind at run-time.
"John" <a@b.com> wrote in message
news:#Z**************@tk2msftngp13.phx.gbl...
Hi all,
How do I completely remove a dynamically-loaded user control and replace
it with another one?
Regards
John.