Ask a Question related to ASP.NET General, Design and Development.
-
John #1
Replacing a user control with another one
Hi all,
How do I completely remove a dynamically-loaded user control and replace it
with another one?
Regards
John.
John Guest
-
user control problem access value from user control to a page
Thanks a lot for paying attention to my problem , i tell u the problem i have a main form in which i gave a login label that points to a... -
Replacing # character in user input strings
I have a custom tag I use quite often for formatting large strings with HTML paragraph tags as well as some other useful text manipulation like... -
Dynamically Adding User Control with Child User Control
I have a user control that has a child user control. If I drag this onto the page, it appears and functions normally. If I attempt to add the... -
Replacing a control dymamically (to use a webform as a template)
Hi all, I have to replace a bunch of controls dynamically (TextBoxes, DropDowns, etc). Any way to do this? The 'template' pages are made on... -
Know in user control page_load if an user control event is going to be fired
Hi all, i have built a user control that shows a map and let the user zoom in, out, usual stuff. Putting this object in a webform the user can... -
David Waz... #2
Re: Replacing a user control with another one
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:#ZIkZjBRDHA.2480@tk2msftngp13.phx.gbl...it> Hi all,
>
> How do I completely remove a dynamically-loaded user control and replace> with another one?
>
> Regards
> John.
>
>
David Waz... Guest
-
Victor Garcia Aprea [MVP] #3
Re: Replacing a user control with another one
Hi John,
Just remove it from the control tree and add the new one, take a look at the
ControlCollection type
--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
[url]http://obies.com/vga/blog.aspx[/url]
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
"John" <a@b.com> wrote in message
news:%23ZIkZjBRDHA.2480@tk2msftngp13.phx.gbl...it> Hi all,
>
> How do I completely remove a dynamically-loaded user control and replace> with another one?
>
> Regards
> John.
>
>
Victor Garcia Aprea [MVP] Guest



Reply With Quote

