By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,769 Members | 1,625 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,769 IT Pros & Developers. It's quick & easy.

How to remove a user control dynamically

P: n/a
Hi,

I have a user control that I add dynamically. Once certain action is
performed I want to remove it completely.

My questions are
1. How do you check to see if a user control already exists or not?
2. How do you remove it after it's been added?

I added by doing the following
Control ActivateOrderControl = LoadControl("activatelicense.ascx")
panelView.Controls.Add(ActivateOrderControl);

Thank you
Maz.

Feb 5 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You can remove it the same way using remove instead of Add and perhaps a
findcontrol instead of the loop.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
<ma*******@gmail.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
Hi,

I have a user control that I add dynamically. Once certain action is
performed I want to remove it completely.

My questions are
1. How do you check to see if a user control already exists or not?
2. How do you remove it after it's been added?

I added by doing the following
Control ActivateOrderControl = LoadControl("activatelicense.ascx")
panelView.Controls.Add(ActivateOrderControl);

Thank you
Maz.

Feb 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.